Back to Firebase Js Sdk

PipelineSource class

docs-devsite/firestore_pipelines.pipelinesource.md

12.12.17.0 KB
Original Source

Project: /docs/reference/js/_project.yaml Book: /docs/reference/_book.yaml page_type: reference

{% comment %} DO NOT EDIT THIS FILE! This is generated by the JS SDK team, and any local changes will be overwritten. Changes should be made in the source code at https://github.com/firebase/firebase-js-sdk {% endcomment %}

PipelineSource class

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.

<b>Signature:</b>

typescript
export declare class PipelineSource<PipelineType> 

Methods

MethodModifiersDescription
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.

PipelineSource.collection()

Returns all documents from the entire collection. The collection can be nested.

<b>Signature:</b>

typescript
collection(collection: string | Query): PipelineType;

Parameters

ParameterTypeDescription
collectionstring | QueryName or reference to the collection that will be used as the Pipeline source.

<b>Returns:</b>

PipelineType

PipelineSource.collection()

Returns all documents from the entire collection. The collection can be nested.

<b>Signature:</b>

typescript
collection(options: CollectionStageOptions): PipelineType;

Parameters

ParameterTypeDescription
optionsCollectionStageOptionsOptions defining how this CollectionStage is evaluated.

<b>Returns:</b>

PipelineType

PipelineSource.collectionGroup()

Returns all documents from a collection ID regardless of the parent.

<b>Signature:</b>

typescript
collectionGroup(collectionId: string): PipelineType;

Parameters

ParameterTypeDescription
collectionIdstringID of the collection group to use as the Pipeline source.

<b>Returns:</b>

PipelineType

PipelineSource.collectionGroup()

Returns all documents from a collection ID regardless of the parent.

<b>Signature:</b>

typescript
collectionGroup(options: CollectionGroupStageOptions): PipelineType;

Parameters

ParameterTypeDescription
optionsCollectionGroupStageOptionsOptions defining how this CollectionGroupStage is evaluated.

<b>Returns:</b>

PipelineType

PipelineSource.createFrom()

Convert the given Query into an equivalent Pipeline.

<b>Signature:</b>

typescript
createFrom(query: Query): Pipeline;

Parameters

ParameterTypeDescription
queryQueryA Query to be converted into a Pipeline.

<b>Returns:</b>

Pipeline

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.

<b>Signature:</b>

typescript
database(): PipelineType;

<b>Returns:</b>

PipelineType

PipelineSource.database()

Returns all documents from the entire database.

<b>Signature:</b>

typescript
database(options: DatabaseStageOptions): PipelineType;

Parameters

ParameterTypeDescription
optionsDatabaseStageOptionsOptions defining how a DatabaseStage is evaluated.

<b>Returns:</b>

PipelineType

PipelineSource.documents()

Set the pipeline's source to the documents specified by the given paths and DocumentReferences.

<b>Signature:</b>

typescript
documents(docs: Array<string | DocumentReference>): PipelineType;

Parameters

ParameterTypeDescription
docsArray<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.

<b>Returns:</b>

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.

<b>Signature:</b>

typescript
documents(options: DocumentsStageOptions): PipelineType;

Parameters

ParameterTypeDescription
optionsDocumentsStageOptionsOptions defining how this DocumentsStage is evaluated.

<b>Returns:</b>

PipelineType

Exceptions

FirestoreError Thrown if any of the provided DocumentReferences target a different project or database than the pipeline.