MutateInSpec.replace constructor

MutateInSpec.replace(
  1. String path,
  2. Object? value, {
  3. bool? xattr,
})

Creates a MutateInSpec for replacing a field on a document.

This updates the value of the specified field, failing if the field does not exits.

value must be a JSON-serializable value or a MutateInMacro.

When xattr is true, this operation references the extended attribute data of the document. Otherwise, it references the document body. Defaults to false.

Implementation

factory MutateInSpec.replace(
  String path,
  Object? value, {
  bool? xattr,
}) {
  return MutateInSpec._create(
    Opcode.replace,
    path,
    value,
    xattr: xattr,
  );
}