[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-20。"],[[["\u003cp\u003eFirestore is a NoSQL document database, with Datastore mode being optimized for server use cases and App Engine, while Native mode is better for mobile and real-time notifications.\u003c/p\u003e\n"],["\u003cp\u003eDatastore mode utilizes indexes for every query, automatically creating single-property indexes and requiring configuration of composite indexes for complex queries in the \u003ccode\u003eindex.yaml\u003c/code\u003e file.\u003c/p\u003e\n"],["\u003cp\u003eApp Engine apps have a default service account with full read and write access to Datastore mode and Firestore databases within the same project, with permissions that can be modified but may affect app access.\u003c/p\u003e\n"],["\u003cp\u003eA local emulator is available via the Google Cloud CLI for developing and testing applications locally, which can also generate and manage indexes for the production environment.\u003c/p\u003e\n"],["\u003cp\u003eDatastore mode has a free quota with daily limits, while paid accounts have unlimited storage and operations.\u003c/p\u003e\n"]]],[],null,["# Using Cloud Firestore in Datastore Mode\n\nGo Java Node.js PHP Python Ruby\n\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\nFirestore is a NoSQL document database built for automatic scaling,\nhigh performance, and ease of application development. It is the newest version\nof Datastore and introduces several improvements over\nDatastore.\n\nBecause [Firestore in Datastore mode (Datastore)](/datastore/docs) is optimized for\nserver use cases and for App Engine, we recommend using\nDatastore mode for databases that will be used primarily by\nApp Engine apps. Firestore in Native mode is most useful for\nmobile and real-time notification use cases. For more information about\nFirestore modes, see [Choosing between Native Mode and\nDatastore mode](/datastore/docs/firestore-or-datastore).\n\nUsing Datastore mode with App Engine\n------------------------------------\n\nTo use Datastore mode with App Engine:\n\n1. If you haven't already done so,\n [create a database](/datastore/docs/store-query-data#create_a_database)\n and choose Firestore in Datastore mode.\n\n You can use existing Datastore databases with App Engine\n apps. These existing databases [will be automatically upgraded to\n Firestore in Datastore\n mode](/datastore/docs/upgrade-to-firestore).\n\nConfiguring indexes\n-------------------\n\nDatastore mode uses\n[indexes](/datastore/docs/concepts/indexes)\nfor every query your application makes. The indexes are updated whenever an\nentity changes, so the results can be returned quickly when the app makes a\nquery.\n\nDatastore mode automatically creates single-property indexes for use with\nsimple types of queries. For complex queries that include multiple properties,\nyou'll need to configure composite indexes in your app's `index.yaml` file.\n\nThe App Engine development server will update your `index.yaml` file\nwith the composite indexes needed to run your tests. Similarly, the\n[Datastore mode emulator can generate indexes](/datastore/docs/tools)\nwhen you run tests.\n\nYou can also add the indexes to your app's\n`index.yaml` file [manually](/appengine/docs/standard/configuring-datastore-indexes-with-index-yaml)\nif you do not run local tests or your tests do not include complex queries.\n\nSetting database permissions\n----------------------------\n\nBy default, your app has all the permissions required to read and write to\nDatastore mode and Firestore databases in your\nGoogle Cloud project.\n\nTo manage these permissions, each App Engine app uses a [default service\naccount](/appengine/docs/standard/default-service-account)\nthat gives full read and write access to Datastore mode\nand Firestore databases in the same project as the app. You can\n[change the permissions of the default service\naccount](/appengine/docs/standard/access-control#modify-service-account),\nbut your app may lose access unless you assign an IAM role with the\n[required permissions](/datastore/docs/access/iam#required_permissions).\n\nFor information about allowing other users, apps, or projects to access a database, see\n[Accessing your database](/datastore/docs/activate).\n\nUsing the Datastore mode emulator for local testing\n---------------------------------------------------\n\n\u003cbr /\u003e\n\n\nThe Google Cloud CLI includes a local [emulator of the production Datastore mode\nmode environment](/datastore/docs/tools/datastore-emulator).\nYou can use the emulator to develop and test your application locally. In\naddition, the emulator can help you generate indexes for your production\nDatastore mode mode instance and delete unneeded indexes.\n\nIf you use the App Engine [local development\nserver](/appengine/docs/standard/python/tools/using-local-server) to test your\napp, you can ensure that the server will use the Datastore mode\nemulator by setting the `--support_datastore_emulator=true` flag when starting\nthe server.\n\nIf you are using the Datastore mode emulator, dev_appserver will display: \n\n ... Using Cloud Datastore Emulator.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nPricing, quotas, and limits\n---------------------------\n\nDatastore mode offers a free quota with daily limits. Paid\naccounts offer unlimited storage, read, and write operations. More information\nis available on the [Datastore Quotas](/appengine/docs/standard/quotas#Datastore) page."]]