Stay organized with collections Save and categorize content based on your preferences.
Store and query data in Firestore in Datastore modeThis page shows you how to store and query data in Firestore in Datastore mode using the Google Cloud console.
Before you beginIn the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Note: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Note: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.If you are not the project owner, your account requires the following permissions to complete this quickstart:
datastore.databases.create
permission needed to create a Datastore mode instance.appengine.applications.create
permission. The project owner can assign this permission with an IAM custom role.To create a new database instance, open the Datastore section in the Google Cloud console:
Go to the Datastore page
Select a database mode.
When you create a new Firestore database, you have the option to use Firestore in either Native Mode or Datastore mode. You can't use both modes in the same project.
Select from one of the database options:
Firestore in Native Mode
Recommended for mobile and web apps. To get started with Firestore, continue in the Firestore Quickstart.
Firestore in Datastore Mode
Recommended for app architectures with backend servers.
For more guidance on selecting a database mode and for a feature-by-feature comparison, see choosing between Native Mode and Datastore Mode.
Select a database location. Datastore mode supports multi-region and regional locations.
A multi-region location maximizes availability and durability. Regional locations offer lower write latency. To learn more about location types, see Datastore mode locations. The location applies to both Datastore mode databases and App Engine apps for your Google Cloud project.
Warning: Once you create your database, you cannot change the location.Click Create database. After your database finishes initializing, the Google Cloud console directs you to the Datastore Entities page.
Go to the Datastore Entities page in the Google Cloud console.
This page lets you store, query, update, and delete data.
Click Create entity.
On the Create an entity page, use [default]
for Namespace.
Type Task
in the Kind field. Leave Key identifier set to the default value of Numeric ID (auto-generated)
.
Under Properties, use the Add property button to add these properties:
Name Type Value Indexed description String Learn about Datastore. created Date and time (today's date) ✓ done Boolean False ✓ Your creation page should now look like this:Click Create. The console displays the Task
entity that you just created.
You just stored data in your database!
Run a queryDatastore mode databases support querying data by kind or by Google Query Language (GQL). The instructions below walk you through using both to query your database.
Run kind queriesTask
as the kind.The query results show the Task
entity that you created.
Next, add a query clause to restrict the results to entities that meet specific criteria:
WHERE
, done
, ==
, boolean, and false.Task
entity that you created since its done
value is false
.WHERE
, done
, ==
, boolean, and true. Click Run. The results do not include the Task
entity that you created, because its done
value is not true
.SELECT * FROM Task
as the query. Note that Task
is case sensitive.The query results show the Task
entity that you created.
The GQL query editor supports autocompletion for kinds: When you need to type a kind name, press Ctrl+Space to see a list of the available kinds. Up to 300 alphabetically sorted kinds can appear in the list. For better matches of kinds, type one or more characters.
Add a query filter to restrict the results to entities that meet specific criteria:
SELECT * FROM Task WHERE done=false
. Note that Task
and done
are case sensitive. The results show the Task
entity that you created, since its done
value is false
.SELECT * FROM Task WHERE done=true
. The results do not include the Task
entity that you created, because its done
value is not true
.Task
is the selected kind.Task
entity that you created.Task
entity. Depending on the size of the browser window, Delete might be under the more_vert More actions menu. Once deleted, the entity is permanently removed from your database.That's it, you completed this quickstart!
What's nextExcept as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["This guide demonstrates how to use the Google Cloud console to store and query data in Firestore's Datastore mode."],["Creating a Datastore mode instance requires the Datastore Owner role and an active App Engine application, or the `appengine.applications.create` permission."],["Datastore mode offers multi-region or regional locations, and once set, the database location cannot be changed."],["Data can be stored as entities with properties (name, type, value), and the guide uses a `Task` entity example."],["Data in Datastore can be queried by kind or using Google Query Language (GQL), with support for filtering results based on specific criteria."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4