Datastore Mode
Last updated
Was this helpful?
Last updated
Was this helpful?
There can only be one Cloud Firestore instance associated with a single project. The Datastore instance is automatically created when you enable the API:
There can only be one Datastore instance associated with a single project. The Cloud Firestore in Datastore instance is automatically created when you enable the API:
Because Cloud Firestore is a NoSQL database, you do not need to explicitly create tables, define data schema, etc. Simply use the API to store new documents, and perform CRUD operations.
The easiest way to access Datastore is using Spring Cloud GCP's . This starter provides full Spring Data support for Datastore while implementing idiomatic access patterns.
Spring Data Feature
Supported
ORM
✅
Declarative Transaction
✅
Repository
✅
REST Repository
✅
Query methods
✅
Query annotation
✅
Pagination
✅
Events
✅
Auditing
✅
Add the Spring Data Datastore starter:
There is no explicit configuration required if you use the automatic authentication and project ID detection. I.e., if you already logged in locally with gcloud
command line, then it'll automatically use Datastore from the project you configured in gcloud
.
Because Datastore is a document-oriented NoSQL database, you can have nested structure, you can establish parent-children relationships without complicated foreign keys.
Use Spring Data repository to quickly get CRUD access to the Datastore.
In a business logic service you can utilize the repositories:
Add Spring Data Rest starter:
To access the endpoint for Order:
Spring Data Cloud Datastore allows you to map domain POJOs to Datastore documents via annotations. Read the for details
Read the for more details.
can expose a Spring Data repository directly on a RESTful endpoint, and rendering the payload as JSON with format. It supports common access patterns like pagination.