update method

Pipeline update({
  1. List<Selectable> transformedFields = const <Selectable>[],
  2. Map<String, Object?>? rawOptions,
})

Writes every input document back to where it was read from.

With transformedFields only those fields are written, with the values of the given aliased expressions. Without them the documents are written as the preceding stages left them (for example after addFields). See delete for how write stages behave.

Implementation

Pipeline update({
  List<Selectable> transformedFields = const <Selectable>[],
  Map<String, Object?>? rawOptions,
}) {
  final Map<String, Expression> fields = selectablesToMap(
    transformedFields,
    method: 'update',
  );
  return _append(
    Stage(
      'update',
      args: <pb.Value Function(PipelineEncoder)>[
        (PipelineEncoder encoder) => encodeExpressionMap(encoder, fields),
      ],
      rawOptions: rawOptions,
    ),
  );
}