execute method

Future<PipelineSnapshot> execute({
  1. bool atomic = false,
  2. PipelineIndexMode? indexMode,
  3. PipelineExplainOptions? explainOptions,
  4. Map<String, Object?>? rawOptions,
})

Executes this pipeline on the server.

rawOptions are named options sent to the server as they are.

With atomic the pipeline runs in a read-write transaction that is committed when it completes, so the writes of a write stage (delete, update, insert, upsert) are applied together or not at all.

With explainOptions the server is asked to explain how it runs the pipeline; the explanation is in PipelineSnapshot.explainStats.

Options this SDK has no parameter for go into rawOptions.

To run a pipeline inside a transaction, use Transaction.execute.

Implementation

Future<PipelineSnapshot> execute({
  bool atomic = false,
  PipelineIndexMode? indexMode,
  PipelineExplainOptions? explainOptions,
  Map<String, Object?>? rawOptions,
}) async {
  checkExecutable();
  final PipelineEncoder encoder = PipelineEncoder(firestore.modelDatabaseId);
  final proto.ExecutePipelineRequest request = toExecuteRequest(
    encoder,
    atomic: atomic,
    indexMode: indexMode,
    explainOptions: explainOptions,
    rawOptions: rawOptions,
  );
  final List<proto.ExecutePipelineResponse> responses = await firestore.client
      .executePipeline(request);
  return decodePipelineResponses(
    this,
    firestore,
    encoder.serializer,
    responses,
  );
}