Google Cloud Firestore is a hosted NoSQL database built for automatic scaling, high performance, and ease of application development.
These code samples demonstrate how to access the Google Cloud Firestore API using the Beta version of the Firestore Client Libraries.
Note: You cannot use both Cloud Firestore and Cloud Datastore in the same project, which might affect apps using App Engine. Try using Cloud Firestore with a different project.
- Install Maven.
- Open the Firebase Console and click Add project.
- Select the option to Enable Cloud Firestore Beta for this project.
- Click Create Project. When you create a Cloud Firestore project, it also enables the API in the Cloud API Manager.
- Create a service account
and set the
GOOGLE_APPLICATION_CREDENTIALS
environment variable to point to the credentials JSON file.
Build your project:
mvn clean package
Quickstart.java demonstrates adding and querying documents in a collection in Firestore. You can run the quickstart with:
mvn exec:java -Dexec.mainClass=com.example.firestore.Quickstart -Dexec.args="your-firestore-project-id"
Note: the default project-id will be used if no argument is provided.
These code samples support the Firestore documentation.
Run all tests:
mvn clean verify