Package com.google.cloud.firestore
Class PipelineSource
java.lang.Object
com.google.cloud.firestore.PipelineSource
A factory for creating
Pipeline instances, which provide a framework for building data
transformation and query pipelines for Firestore.
Start by calling Firestore.pipeline() to obtain an instance of PipelineSource.
From there, you can use the provided methods (like collection(String)) to specify the
data source for your pipeline.
This class is typically used to start building Firestore pipelines. It allows you to define the initial data source for a pipeline.
Example Usage:
firestore.pipeline() // Get a PipelineSource instance
.collection("users") // Create a pipeline that operates on a collection
.select("name"); // Add stages to the pipeline
-
Method Summary
Modifier and TypeMethodDescriptioncollection(String path) Creates a newPipelinethat operates on the specified Firestore collection.collection(String path, CollectionOptions options) collectionGroup(String collectionId) Creates a newPipelinethat operates on all documents in a collection group.collectionGroup(String collectionId, CollectionGroupOptions options) createFrom(AggregateQuery query) Creates a newPipelinefrom the givenAggregateQuery.createFrom(Query query) database()Creates a newPipelinethat operates on all documents in the Firestore database.documents(DocumentReference... docs) Creates a newPipelinethat operates on a specific set of Firestore documents.Creates a newPipelinethat operates on a specific set of Firestore documents.
-
Method Details
-
collection
Creates a newPipelinethat operates on the specified Firestore collection.- Parameters:
path- The path to the Firestore collection (e.g., "users").- Returns:
- A new
Pipelineinstance targeting the specified collection.
-
collection
-
collection
-
collectionGroup
Creates a newPipelinethat operates on all documents in a collection group.A collection group consists of all collections with the same ID. For example, if you have collections named "users" under different documents, you can query them together using a collection group query.
- Parameters:
collectionId- The ID of the collection group.- Returns:
- A new
Pipelineinstance targeting the specified collection group.
-
collectionGroup
@Nonnull @BetaApi public Pipeline collectionGroup(@Nonnull String collectionId, CollectionGroupOptions options) -
database
Creates a newPipelinethat operates on all documents in the Firestore database.Use this method with caution as it can lead to very large result sets. It is usually only useful at development stage.
- Returns:
- A new
Pipelineinstance targeting all documents in the database.
-
documents
Creates a newPipelinethat operates on a specific set of Firestore documents.- Parameters:
docs- TheDocumentReferenceinstances representing the documents to include in the pipeline.- Returns:
- A new
Pipelineinstance targeting the specified documents.
-
documents
Creates a newPipelinethat operates on a specific set of Firestore documents.- Parameters:
docs- TheDocumentReferenceinstances representing the documents to include in the pipeline.- Returns:
- A new
Pipelineinstance targeting the specified documents.
-
createFrom
Creates a newPipelinefrom the givenQuery. Under the hood, this will translate the query semantics (order by document ID, etc.) to an equivalent pipeline.- Parameters:
query- TheQueryto translate into the resulting pipeline.- Returns:
- A new
Pipelinethat is equivalent to the given query.
-
createFrom
Creates a newPipelinefrom the givenAggregateQuery. Under the hood, this will translate the query semantics (order by document ID, etc.) to an equivalent pipeline.- Parameters:
query- TheAggregateQueryto translate into the resulting pipeline.- Returns:
- A new
Pipelinethat is equivalent to the given query.
-