MutateInSpec.upsert constructor
Creates a MutateInSpec for upserting a field on a document.
This updates the value of the specified field, or creates the field if it does not exits.
value must be a JSON-serializable value or a MutateInMacro.
When createPath is true, the path to the field will be created if it
does not already exist. Defaults to false.
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.upsert(
String path,
Object? value, {
bool? createPath,
bool? xattr,
}) {
return MutateInSpec._create(
path == '' ? Opcode.setDoc : Opcode.dictUpsert,
path,
value,
createPath: createPath,
xattr: xattr,
);
}