Using Cloud Firestore in Datastore Mode Stay organized with collections Save and categorize content based on your preferences.
Firestore is a NoSQL document database built for automatic scaling,high performance, and ease of application development. It is the newest versionof Datastore and introduces several improvements overDatastore.
Because Firestore inDatastore modeis optimized for server use cases and forApp Engine, we recommend using Firestore inDatastore mode for databases that will be used primarily byApp Engine apps. Firestore in Native mode is most useful formobile and real-time notification use cases. For more information aboutFirestore modes, seeChoosing between Native Mode andDatastore mode.
Using Datastore mode with App Engine
To use Datastore mode with App Engine:
If you haven't already done so,create a databaseand choose Firestore in Datastore mode.
You can use existing Datastore databases with App Engineapps. These existing databaseswill be automatically upgraded toFirestore in Datastoremode.
to create, retrieve, and manage entities in your Datastore modedatabase.
If you are planning to upgrade your Python 2 app to Python 3, you have a few options:
If your Python 2 app usesApp Engine NDBto interact with Datastore, we recommendmigrating to Cloud NDB instead of the Datastore mode client library as the formerprovides a much more similar user experience.
You can also choose to port your Python 2 app that uses App EngineNDB to Python 3 first andthen migrate to Cloud NDB. To learn how to accessApp Engine NDB in Python 3, see theAccessing App Engine bundledservices for Python 3 page.
For additional resources plus an example of migrating from a Python 2webappapp using App Engine NDB to an equivalent Python 3 Flask app with App Engine NDBenabled, see thebundled services for Python 3page.
Configuring indexes
Datastore mode usesindexesfor every query your application makes. The indexes are updated whenever anentity changes, so the results can be returned quickly when the app makes aquery.
Datastore mode automatically creates single-property indexes for use withsimple types of queries. For complex queries that include multiple properties,you'll need to configure composite indexes in your app'sindex.yaml file.
The App Engine development server will update yourindex.yaml filewith the composite indexes needed to run your tests. Similarly, theDatastore mode emulator can generate indexeswhen you run tests.
You can also add the indexes to your app'sindex.yaml filemanually if you do not run localtests or your tests do not include complex queries.
Setting database permissions
By default, your app has all the permissions required to read and write toDatastore mode and Firestore databases in yourGoogle Cloud project.
To manage these permissions, each App Engine app uses adefault serviceaccountthat gives full read and write access to Datastore modeand Firestore databases in the same project as the app. You canchange the permissions of the default serviceaccount,but your app may lose access unless you assign an IAM role with therequired permissions.
For information about allowing other users, apps, or projects to access a database, seeAccessing your database.
Pricing, quotas, and limits
Datastore mode offers a free quota with daily limits. Paidaccounts offer unlimited storage, read, and write operations. More informationis available on theDatastore Quotas page.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-15 UTC.