All Datastore mode code samples
This page contains code samples for Firestore in Datastore mode. To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.
Example datastore merged index tag queries
Example datastore merged index tag queries
- Datastore
- Google Cloud
- Python
NDB Context Usage
Use Cloud NDB client context to query a Datastore model within a function
- Datastore
- Google Cloud
- Python
Run projection query
Run a projection query.
- Datastore
- Google Cloud
- Ruby
- C#
- Node JS
- Go
- JavaScript
- Python
- PHP
- Java
Property by kind query
Query property by kind.
- Datastore
- Google Cloud
- C#
- PHP
- Node JS
- Python
- Ruby
- Java
- JavaScript
- Go
Example datastore list tasks
Example datastore list tasks
- Google Cloud
- Datastore
- Python
- C#
- Go
- Ruby
- PHP
- JavaScript
- Java
- Node JS
Get or create
Get or create in a transaction.
- Google Cloud
- Datastore
- PHP
- C#
- Node JS
- JavaScript
- Ruby
- Java
- Go
- Python
Key with single parent
Make a key with a single parent.
- Datastore
- Google Cloud
- Java
- PHP
- C#
- Ruby
- Go
- JavaScript
- Python
- Node JS
An example of a valid inequality range filter.
Demonstrates a valid inequality range filter.
- Datastore
- Google Cloud
- PHP
- Ruby
- Node JS
- C#
- Python
- Go
- JavaScript
- Java
Invalid inequality range filter
An example of an invalid inequality range filter.
- Datastore
- Google Cloud
- C#
- Go
- Ruby
- JavaScript
- Java
- Node JS
- Python
Create a new Datastore admin client
Create a new Datastore admin client.
- Google Cloud
- Datastore
- Python
- C#
- Go
- Ruby
Inequality sort
Inequality sort must be first. Use inequality sort constraints.
- Datastore
- Google Cloud
- C#
- PHP
- Python
- Go
- Java
- JavaScript
- Node JS
- Ruby
Example datastore mark task done
Example datastore mark task done
- Google Cloud
- Datastore
- PHP
- C#
- Ruby
- Go
- Node JS
- Python
- Java
- JavaScript
Inequality sort invalid because it's not sorted by the same property
Inequality sort must be sorted by the same property and first. Use inequality sort constraints.
- Google Cloud
- Datastore
- Python
- Node JS
- JavaScript
- Java
- Ruby
- PHP
- C#
- Go
Export a copy of all or a subset of entities
Exports a copy of all or a subset of entities from Datastore to another storage system, such as Cloud Storage.
- Datastore
- Google Cloud
- C#
- Python
- Node JS
- Ruby
- JavaScript
- Go
Example datastore owner size tag query
Example datastore owner size tag query
- Google Cloud
- Datastore
- Python
Filter array value with inequality range
Filter array value with inequality range.
- Google Cloud
- Datastore
- JavaScript
- PHP
- Python
- Java
- Go
- Ruby
- C#
- Node JS
Key with ancestors
Make a key with ancestors.
- Google Cloud
- Datastore
- Node JS
- Ruby
- Go
- Java
- PHP
- JavaScript
- C#
- Python
List admin index
List indexes within a Datastore project
- Google Cloud
- Datastore
- Go
- Node JS
- C#
- Ruby
- Python
- JavaScript
Query on unindexed property
Use a query on an unindexed property.
- Datastore
- Google Cloud
- Go
- Node JS
- PHP
- Java
- Python
- Ruby
- C#
- JavaScript
Import admin entities to Datastore
Import admin entities to Datastore
- Google Cloud
- Datastore
- Ruby
- Node JS
- JavaScript
- Go
- Python
- C#
Add task
Creates and saves an Entity of the hypothetical type "Task"
- Google Cloud
- Datastore
- C#
- Python
- PHP
- Node JS
- Java
- JavaScript
- Ruby
Transactional single entity group read-only
Use a read-only transaction.
- Datastore
- Google Cloud
- C#
- Java
- Node JS
- Python
- PHP
- JavaScript
- Ruby
- Go
Build service
Build a service by using various CRUD methods.
- Datastore
- Google Cloud
- Java
- PHP
- Node JS
- JavaScript
- Python
- Go
- Ruby
- C#
Distinct on query
Use distinct clause in a query.
- Google Cloud
- Datastore
- Python
- PHP
- Ruby
- JavaScript
- C#
- Node JS
- Go
- Java
Inequality sort invalid because it's not first
Inequality sort must be first. Use inequality sort constraints.
- Datastore
- Google Cloud
- Go
- C#
- Python
- Ruby
- JavaScript
- PHP
- Java
- Node JS
Filter array value with equality
Filter array value with equality range.
- Datastore
- Google Cloud
- Java
- Ruby
- Node JS
- C#
- JavaScript
- Go
- PHP
- Python
Example datastore size coloration query
Example datastore size coloration query
- Google Cloud
- Datastore
- Python
Create a union of two filters (OR operator)
This snippet creates the union (logical OR) of two queries, where the results of each query is combined in the final results.
- Google Cloud
- Datastore
- Java
- JavaScript
- Python
- Node JS
Entity with parent
Use entity with parent.
- Google Cloud
- Datastore
- Python
- Go
- Ruby
- C#
- Java
- JavaScript
- Node JS
- PHP
Eventual consistent query read policy
Use a read policy.
- Datastore
- Google Cloud
- JavaScript
- C#
- Python
- PHP
- Ruby
- Go
- Java
- Node JS
Equality and inequality range filter
Filter range by equality and inequality.
- Datastore
- Google Cloud
- JavaScript
- Java
- PHP
- Python
- Go
- Node JS
- Ruby
- C#