Přeskočit na obsah
_CORE
AI & Agentic Systems Core Informační Systémy Cloud & Platform Engineering Data Platforma & Integrace Security & Compliance QA, Testing & Observability IoT, Automatizace & Robotika Mobile & Digital Banky & Finance Pojišťovnictví Veřejná správa Obrana & Bezpečnost Zdravotnictví Energetika & Utility Telco & Média Průmysl & Výroba Logistika & E-commerce Retail & Loyalty
Reference Technologie Blog Knowledge Base O nás Spolupráce Kariéra
Pojďme to probrat

Google Firestore — Serverless NoSQL

01. 01. 2024 1 min čtení intermediate

Cloud Pokročilý

Google Firestore — Serverless NoSQL

GCPFirestoreNoSQLReal-time 5 min čtení

Firestore datový model, real-time listeners, security rules a offline podpora.

Datový model

// collections → documents → subcollections
await setDoc(doc(db, 'users', 'uid123'), {
  name: 'Jan Novák', email: 'jan@example.com',
  createdAt: serverTimestamp()
});

Real-time Listeners

onSnapshot(query(collection(db, 'messages'),
  where('roomId', '==', 'room-42'),
  orderBy('createdAt', 'desc'), limit(50)
), snapshot => {
  snapshot.docChanges().forEach(change => {
    if (change.type === 'added') renderMessage(change.doc.data());
  });
});

Security Rules

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /users/{userId} {
      allow read: if request.auth != null;
      allow write: if request.auth.uid == userId;
    }
  }
}

Shrnutí

Firestore = ideální pro mobile/web apps s real-time sync a offline podporou.

Potřebujete pomoct s implementací?

Náš tým má zkušenosti s návrhem a implementací moderních architektur. Rádi vám pomůžeme.

Nezávazná konzultace