public final class PipelineSourceA 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
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 |
StringThe path to the Firestore collection (e.g., "users"). |
| Returns | |
|---|---|
| Type | Description |
Pipeline |
A new |
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 |
StringThe ID of the collection group. |
| Returns | |
|---|---|
| Type | Description |
Pipeline |
A new |
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 |
AggregateQueryThe AggregateQuery to translate into the resulting pipeline. |
| Returns | |
|---|---|
| Type | Description |
Pipeline |
A new |
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 |
QueryThe Query to translate into the resulting pipeline. |
| Returns | |
|---|---|
| Type | Description |
Pipeline |
A new |
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 |
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 |
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 |