Skip to main content

Firestore

Exam guide§2.2
Firestore

Serverless, autoscaling document (NoSQL) database with real-time listeners and offline sync for web/mobile. Strong consistency, scales to zero cost when idle. Pick it for hierarchical mobile/web data - user profiles, game state. (Datastore mode is the legacy/server API.)

What Firestore gives you

A fast, fully managed, serverless, cloud-native NoSQL document database that simplifies storing, syncing, and querying data for mobile, web, and IoT apps at global scale.

FactsFirestore at a glance
  • Live sync + offline support - client libraries keep data current and work offline
  • Security + integrations - Firebase and Google Cloud integrations for truly serverless apps
  • ACID transactions - all-or-nothing writes
  • Automatic multi-region replication + strong consistency - data stays safe and available through outages
  • Powerful query engine - sophisticated queries with no performance degradation, so you have more freedom in how you structure data
GotchaACID means the whole transaction fails together

If any operation in a transaction fails and cannot be retried, the entire transaction fails - nothing is partially committed.

Native mode vs Datastore mode

Firestore is the next generation of Datastore. A single Firestore database runs in one of two modes, chosen at creation and not changeable later.

Datastore modeNative modeBest forNew server projectsNew mobile and web appsCompatibilityBackwards-compatible with Datastoreapps, APIs, and client librariesNew data model - not backwards-compatible with DatastoreConsistencyStrong consistency (queries nolonger eventually consistent)New strongly consistent storage layerData modelDatastore entity groupsCollection and document modelExtra features-Real-time updates; mobile andweb client libraries
Both modes share one improved storage layer. Datastore mode keeps Datastore behavior for server projects; Native mode adds the collection/document model, real-time updates, and mobile/web client libraries.

Creating a database in Datastore mode gives you Firestore's improved storage layer while keeping Datastore system behavior, which removes three old Datastore limits.

NumbersLimits Datastore mode removes
  • Queries are strongly consistent, no longer eventually consistent
  • Transactions are no longer limited to 25 entity groups
  • Writes to an entity group are no longer limited to 1 per second
GotchaBackwards-compatibility is one-way

Firestore is backwards-compatible with Datastore, but the new data model, real-time updates, and mobile/web client libraries are not. To access all the new Firestore features you must use Native mode. As the next generation of Datastore, Firestore is compatible with all Datastore APIs and client libraries.

DECISIONWhich Firestore mode?
A new server-side projectDatastore mode
A new mobile or web app (needs real-time + client libraries)Native mode
Pick this when: server project → Datastore mode; mobile/web app → Native mode

Choosing Firestore

Reach for Firestore when your schema might change and you need an adaptable database, you need to scale to zero, or you want low-maintenance scaling up to terabytes. If you do not require transactional consistency, consider Bigtable instead, depending on cost or size.

StartNoYesNocost / sizeSchema might changeand need an adaptabledatabase?Scale downto zero?Want low maintenanceoverhead scalingup to TBs?Transactional consistencyrequired?ConsiderFirestoreConsiderBigtable
Follow the green Yes path: an adaptable schema, scale-to-zero, or low-maintenance TB-scale storage all land on Firestore. Only if none hold and you do not need transactional consistency do you fall through to Bigtable, chosen on cost and size.