Class Pipelines.PipelineSnapshot (9.4.1)

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.

Implements

firestore.Pipelines.PipelineSnapshot

Package

@google-cloud/firestore

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());
});

Constructors

(constructor)(pipeline, results, executionTime, explainStats)

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

Constructs a new instance of the PipelineSnapshot class

Parameters
Name Description
pipeline Pipeline
results PipelineResult[]
executionTime Timestamp
explainStats ExplainStats

Properties

executionTime

get executionTime(): Timestamp;

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

explainStats

get explainStats(): ExplainStats | undefined;

Return stats from query explain.

If explainOptions.mode was set to execute or left unset, then this returns undefined.

pipeline

get pipeline(): Pipeline;

The Pipeline on which you called execute() in order to get this PipelineSnapshot.

results

get results(): PipelineResult[];

An array of all the results in the PipelineSnapshot.