Provides the entry point for defining the data source of a Firestore Pipeline.
Use the methods of this class (e.g., PipelineSource.collection(), PipelineSource.collectionGroup(), PipelineSource.database(), or PipelineSource.documents()) to specify the initial data for your pipeline, such as a collection, a collection group, the entire database, or a set of specific documents.
Signature:
export declare class PipelineSource<PipelineType>
Methods
| Method | Modifiers | Description |
|---|---|---|
| collection(collection) | Returns all documents from the entire collection. The collection can be nested. | |
| collection(options) | Returns all documents from the entire collection. The collection can be nested. | |
| collectionGroup(collectionId) | Returns all documents from a collection ID regardless of the parent. | |
| collectionGroup(options) | Returns all documents from a collection ID regardless of the parent. | |
| createFrom(query) | Convert the given Query into an equivalent Pipeline. | |
| database() | Returns all documents from the entire database. | |
| database(options) | Returns all documents from the entire database. | |
| documents(docs) | Set the pipeline's source to the documents specified by the given paths and DocumentReferences. | |
| documents(options) | Set the pipeline's source to the documents specified by the given paths and DocumentReferences. | |
| literals(documents) | Set the pipeline's source to the documents specified by the given array of literal objects.Each object in the array represents a document where keys are field names and values are constants or Expression instances. | |
| literals(options) | Set the pipeline's source to the documents specified by the given LiteralsStageOptions. |
PipelineSource.collection()
Returns all documents from the entire collection. The collection can be nested.
Signature:
collection(collection: string | CollectionReference): PipelineType;
Parameters
| Parameter | Type | Description |
|---|---|---|
| collection | string | CollectionReference | Name or reference to the collection that will be used as the Pipeline source. |
Returns:
PipelineType
PipelineSource.collection()
Returns all documents from the entire collection. The collection can be nested.
Signature:
collection(options: CollectionStageOptions): PipelineType;
Parameters
| Parameter | Type | Description |
|---|---|---|
| options | CollectionStageOptions | Options defining how this CollectionStage is evaluated. |
Returns:
PipelineType
PipelineSource.collectionGroup()
Returns all documents from a collection ID regardless of the parent.
Signature:
collectionGroup(collectionId: string): PipelineType;
Parameters
| Parameter | Type | Description |
|---|---|---|
| collectionId | string | ID of the collection group to use as the Pipeline source. |
Returns:
PipelineType
PipelineSource.collectionGroup()
Returns all documents from a collection ID regardless of the parent.
Signature:
collectionGroup(options: CollectionGroupStageOptions): PipelineType;
Parameters
| Parameter | Type | Description |
|---|---|---|
| options | CollectionGroupStageOptions | Options defining how this CollectionGroupStage is evaluated. |
Returns:
PipelineType
PipelineSource.createFrom()
Convert the given Query into an equivalent Pipeline.
Signature:
createFrom(query: Query): PipelineType;
Parameters
| Parameter | Type | Description |
|---|---|---|
| query | Query | A Query to be converted into a Pipeline. |
Returns:
PipelineType
Exceptions
FirestoreError Thrown if any of the provided DocumentReferences target a different project or database than the pipeline.
PipelineSource.database()
Returns all documents from the entire database.
Signature:
database(): PipelineType;
Returns:
PipelineType
PipelineSource.database()
Returns all documents from the entire database.
Signature:
database(options: DatabaseStageOptions): PipelineType;
Parameters
| Parameter | Type | Description |
|---|---|---|
| options | DatabaseStageOptions | Options defining how a DatabaseStage is evaluated. |
Returns:
PipelineType
PipelineSource.documents()
Set the pipeline's source to the documents specified by the given paths and DocumentReferences.
Signature:
documents(docs: Array<string | DocumentReference>): PipelineType;
Parameters
| Parameter | Type | Description |
|---|---|---|
| docs | Array<string | DocumentReference> | An array of paths and DocumentReferences specifying the individual documents that will be the source of this pipeline. The converters for these DocumentReferences will be ignored and not have an effect on this pipeline. |
Returns:
PipelineType
Exceptions
FirestoreError Thrown if any of the provided DocumentReferences target a different project or database than the pipeline.
PipelineSource.documents()
Set the pipeline's source to the documents specified by the given paths and DocumentReferences.
Signature:
documents(options: DocumentsStageOptions): PipelineType;
Parameters
| Parameter | Type | Description |
|---|---|---|
| options | DocumentsStageOptions | Options defining how this DocumentsStage is evaluated. |
Returns:
PipelineType
Exceptions
FirestoreError Thrown if any of the provided DocumentReferences target a different project or database than the pipeline.
PipelineSource.literals()
Set the pipeline's source to the documents specified by the given array of literal objects.
Each object in the array represents a document where keys are field names and values are constants or Expression instances.
Signature:
literals(documents: Array<Record<string, unknown>>): PipelineType;
Parameters
| Parameter | Type | Description |
|---|---|---|
| documents | Array<Record<string, unknown>> | An array of literal document objects. |
Returns:
PipelineType
Example
firestore.pipeline().literals([
{ name: 'Alice', score: 50 },
{ name: 'Bob', score: add(constant(30), constant(40)) }
]);
PipelineSource.literals()
Set the pipeline's source to the documents specified by the given LiteralsStageOptions.
Signature:
literals(options: LiteralsStageOptions): PipelineType;
Parameters
| Parameter | Type | Description |
|---|---|---|
| options | LiteralsStageOptions | Options defining how this LiteralsStage is evaluated. |
Returns:
PipelineType