Java samples for Cloud Firestore

Cloud Firestore Quickstart

This sample app demonstrates a basic end-to-end Java integration. The app does not demonstrate advanced Cloud Firestore features or best practices for large data sets.

To browse the sample source, go to the sample page.

To clone the source:

  1. Run git clone https://github.com/GoogleCloudPlatform/java-docs-samples/.
  2. Browse the firestore directory to see relevant code.

To build and run the sample:

  1. Set up your environment to work with Cloud Firestore.
  2. Navigate to the firestore directory on the firestore branch as described above.
  3. Run mvn clean package to build the quickstart.
  4. Run the quickstart, replacing [PROJECT_ID] with your project ID:

     java -cp target/firestore-samples-1.0.0-jar-with-dependencies.jar \
         com.example.firestore.Quickstart [PROJECT_ID]
    

This quickstart demonstrates how to connect to Cloud Firestore, then add and query documents in a collection.

Send feedback about...

Need help? Visit our support page.