Class PipelineSource (3.35.1)

public final class 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
 

Inheritance

java.lang.Object > PipelineSource

Methods

collection(CollectionReference ref)

public Pipeline collection(CollectionReference ref)
Parameter
Name Description
ref CollectionReference
Returns
Type Description
Pipeline

collection(String path)

public Pipeline collection(String path)

Creates a new Pipeline that operates on the specified Firestore collection.

Parameter
Name Description
path String

The path to the Firestore collection (e.g., "users").

Returns
Type Description
Pipeline

A new Pipeline instance targeting the specified collection.

collection(String path, CollectionOptions options)

public Pipeline collection(String path, CollectionOptions options)
Parameters
Name Description
path String
options CollectionOptions
Returns
Type Description
Pipeline

collectionGroup(String collectionId)

public Pipeline collectionGroup(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.

Parameter
Name Description
collectionId String

The ID of the collection group.

Returns
Type Description
Pipeline

A new Pipeline instance targeting the specified collection group.

collectionGroup(String collectionId, CollectionGroupOptions options)

public Pipeline collectionGroup(String collectionId, CollectionGroupOptions options)
Parameters
Name Description
collectionId String
options CollectionGroupOptions
Returns
Type Description
Pipeline

createFrom(AggregateQuery query)

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.

Parameter
Name Description
query AggregateQuery

The AggregateQuery to translate into the resulting pipeline.

Returns
Type Description
Pipeline

A new Pipeline that is equivalent to the given query.

createFrom(Query query)

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.

Parameter
Name Description
query Query

The Query to translate into the resulting pipeline.

Returns
Type Description
Pipeline

A new Pipeline that is equivalent to the given query.

database()

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
Type Description
Pipeline

A new Pipeline instance targeting all documents in the database.

documents(DocumentReference[] docs)

public Pipeline documents(DocumentReference[] docs)

Creates a new Pipeline that operates on a specific set of Firestore documents.

Parameter
Name Description
docs DocumentReference[]

The DocumentReference instances representing the documents to include in the pipeline.

Returns
Type Description
Pipeline

A new Pipeline instance targeting the specified documents.

documents(String[] docs)

public Pipeline documents(String[] docs)

Creates a new Pipeline that operates on a specific set of Firestore documents.

Parameter
Name Description
docs String[]

The DocumentReference instances representing the documents to include in the pipeline.

Returns
Type Description
Pipeline

A new Pipeline instance targeting the specified documents.