Class PipelineSource

java.lang.Object
com.google.cloud.firestore.PipelineSource

@BetaApi public final class PipelineSource extends Object
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 Details

    • collection

      @Nonnull @BetaApi public Pipeline collection(@Nonnull String path)
      Creates a new Pipeline that operates on the specified Firestore collection.
      Parameters:
      path - The path to the Firestore collection (e.g., "users").
      Returns:
      A new Pipeline instance targeting the specified collection.
    • collection

      @Nonnull @BetaApi public Pipeline collection(@Nonnull String path, CollectionOptions options)
    • collection

      @Nonnull @BetaApi public Pipeline collection(@Nonnull CollectionReference ref)
    • collectionGroup

      @Nonnull @BetaApi public Pipeline collectionGroup(@Nonnull String collectionId)
      Creates a new Pipeline that 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 Pipeline instance targeting the specified collection group.
    • collectionGroup

      @Nonnull @BetaApi public Pipeline collectionGroup(@Nonnull String collectionId, CollectionGroupOptions options)
    • database

      @Nonnull @BetaApi public Pipeline database()
      Creates a new Pipeline that 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 Pipeline instance targeting all documents in the database.
    • documents

      @Nonnull @BetaApi public Pipeline documents(DocumentReference... docs)
      Creates a new Pipeline that operates on a specific set of Firestore documents.
      Parameters:
      docs - The DocumentReference instances representing the documents to include in the pipeline.
      Returns:
      A new Pipeline instance targeting the specified documents.
    • documents

      @Nonnull @BetaApi public Pipeline documents(String... docs)
      Creates a new Pipeline that operates on a specific set of Firestore documents.
      Parameters:
      docs - The DocumentReference instances representing the documents to include in the pipeline.
      Returns:
      A new Pipeline instance targeting the specified documents.
    • createFrom

      @Nonnull @BetaApi public Pipeline createFrom(Query query)
      Creates a new Pipeline from the given Query. Under the hood, this will translate the query semantics (order by document ID, etc.) to an equivalent pipeline.
      Parameters:
      query - The Query to translate into the resulting pipeline.
      Returns:
      A new Pipeline that is equivalent to the given query.
    • createFrom

      @Nonnull @BetaApi public Pipeline createFrom(AggregateQuery query)
      Creates a new Pipeline from the given AggregateQuery. Under the hood, this will translate the query semantics (order by document ID, etc.) to an equivalent pipeline.
      Parameters:
      query - The AggregateQuery to translate into the resulting pipeline.
      Returns:
      A new Pipeline that is equivalent to the given query.