Back to Firebase Js Sdk

PipelineSnapshot class

docs-devsite/firestore_pipelines.pipelinesnapshot.md

12.12.12.7 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 %}

PipelineSnapshot class

Represents the results of a Firestore pipeline execution.

A PipelineSnapshot contains zero or more PipelineResult objects representing the documents returned by a pipeline query. It provides methods to iterate over the documents and access metadata about the query results.

<b>Signature:</b>

typescript
export declare class PipelineSnapshot 

Constructors

ConstructorModifiersDescription
(constructor)(pipeline, results, executionTime)Constructs a new instance of the <code>PipelineSnapshot</code> class

Properties

PropertyModifiersTypeDescription
executionTimeTimestampThe time at which the pipeline producing this result is executed.
resultsPipelineResult<!-- -->[]An array of all the results in the <code>PipelineSnapshot</code>.

PipelineSnapshot.(constructor)

Constructs a new instance of the PipelineSnapshot class

<b>Signature:</b>

typescript
constructor(pipeline: Pipeline, results: PipelineResult[], executionTime?: Timestamp);

Parameters

ParameterTypeDescription
pipelinePipeline
resultsPipelineResult<!-- -->[]
executionTimeTimestamp

PipelineSnapshot.executionTime

The time at which the pipeline producing this result is executed.

<b>Signature:</b>

typescript
get executionTime(): Timestamp;

PipelineSnapshot.results

An array of all the results in the PipelineSnapshot<!-- -->.

<b>Signature:</b>

typescript
get results(): PipelineResult[];

Example

typescript
const snapshot: PipelineSnapshot = await firestore
  .pipeline()
  .collection('myCollection')
  .where(field('value').greaterThan(10))
  .execute();

snapshot.results.forEach(doc => {
  console.log(doc.id, '=>', doc.data());
});