Choosing between Native mode and Datastore mode

When you create a new Cloud Firestore database, you can configure the database instance to run in Datastore mode which makes the database backwards-compatible with Datastore. This page helps you understand the difference between the two Cloud Firestore database modes: Native mode and Datastore mode.

Cloud Firestore in Native mode

Cloud Firestore is the next major version of Datastore and a re-branding of the product. Taking the best of Datastore and the Firebase Realtime Database, Cloud Firestore is a NoSQL document database built for automatic scaling, high performance, and ease of application development.

Cloud Firestore introduces new features such as:

  • A new, strongly consistent storage layer
  • A collection and document data model
  • Real-time updates
  • Mobile and Web client libraries

Cloud Firestore is backwards compatible with Datastore, but the new data model, real-time updates, and mobile and web client library features are not. To access all of the new Cloud Firestore features, you must use Cloud Firestore in Native mode.

Cloud Firestore in Datastore mode

Cloud Firestore in Datastore mode uses Datastore system behavior but accesses Cloud Firestore's storage layer, removing the following Datastore limitations:

  • Eventual consistency, all Datastore queries become strongly consistent.
  • Transactions are no longer limited to 25 entity groups.
  • Writes to an entity group are no longer limited to 1 per second.

Datastore mode disables Cloud Firestore features that are not compatible with Datastore:

  • The project will accept Datastore API requests and deny Cloud Firestore API requests.
  • The project will use Datastore indexes instead of Cloud Firestore indexes.
  • You can use Datastore client libraries with this project but not Cloud Firestore client libraries.
  • Cloud Firestore real-time capabilities will not be available.
  • In the Cloud Console, the database will use the Datastore viewer.

Automatic upgrade to Datastore mode

Existing Datastore databases will be automatically upgraded to Cloud Firestore in Datastore mode. New projects that require a Datastore database should use Cloud Firestore in Datastore mode.

Pricing and locations

Native mode and Datastore mode databases use the same pricing structure and are available in the same locations. Pricing and locations are described in detail in the following pages:

Cloud Firestore in Native mode

Cloud Firestore in Datastore mode

Choosing a database mode

We recommend the following when choosing between database modes:

  • Use Cloud Firestore in Datastore mode for new server projects.

    Cloud Firestore in Datastore mode allows you to use established Datastore server architectures while removing fundamental Datastore limitations. Datastore mode can automatically scale to millions of writes per second.

  • Use Cloud Firestore in Native mode for new mobile and web apps.

    Cloud Firestore offers mobile and web client libraries with real-time and offline features. Native mode can automatically scale to millions of concurrent clients.

Feature comparison

The following table compares the system behavior of the database modes:

Cloud Firestore
Native Mode
Cloud Firestore
Datastore Mode
Data model Document database organized into documents and collections. Entities organized into kinds and entity groups.
Storage Layer New storage layer that is always strongly consistent New storage layer that is always strongly consistent
Queries and transactions
  • Strongly consistent queries across the entire database
  • Up to 500 documents per transaction across any number of collections.
  • Limitation: No projection queries.
  • Removes the previous consistency limitations of Datastore
  • Strongly consistent queries across the entire database
  • Transactions can access any number of entity groups
Datastore v1 API support No, requests are denied Yes
Cloud Firestore v1 API support Yes No, requests are denied
Real-time updates

Supports the ability to listen to a document or a set of documents for real-time updates.

While listening to a document or set of documents, your clients are notified of any data changes and sent the newest set of data.

Not supported
Offline data persistence The mobile and web client libraries support offline data persistence. Not supported
Client libraries Cloud Firestore client libraries:
  • Java
  • Python
  • PHP
  • Go
  • Ruby
  • C#
  • Node.js
  • Android
  • iOS
  • Web
Datastore Client libraries:
  • Java
  • Python
  • PHP
  • Go
  • Ruby
  • C#
  • Node.js
Security
  • Cloud Identity and Access Management (IAM) manages database access
  • Cloud Firestore Security Rules support serverless authentication and authorization for the mobile and web client libraries
Cloud Identity and Access Management (IAM) manages database access
Performance Automatically scales to millions of concurrent clients. Max 10,000 writes per second. Automatically scales to millions of writes per second.
SLA Cloud Firestore SLA. Cloud Firestore SLA.
Locations
  • US (Multi-region)
  • Europe (Multi-region)
  • Montréal
  • Los Angeles
  • South Carolina
  • Northern Virginia
  • São Paulo
  • London
  • Frankfurt
  • Tokyo
  • Mumbai
  • Sydney
  • US (Multi-region)
  • Europe (Multi-region)
  • Montréal
  • Los Angeles
  • South Carolina
  • Northern Virginia
  • São Paulo
  • London
  • Frankfurt
  • Tokyo
  • Mumbai
  • Sydney
Pricing Same pricing structure
Console Firebase Console and Cloud Console Firestore Viewer Cloud Console Datastore Viewer
Namespaces Not supported Namespaces supported
App Engine client library integration

Not supported in the App Engine standard environment Python 2.7 and PHP 5.5 runtimes

Supported in the App Engine standard environment Python 3.7, PHP 7.2, Java 8, Go, and Node.js runtimes

Supported in the App Engine flexible environment, all runtimes

Supported in all runtimes
หน้านี้มีประโยชน์ไหม โปรดแสดงความคิดเห็น