An operation which modifies all or selected documents in a collection.
Note that in operations such as set()
, unset()
, arrayInsert()
and arrayAppend()
the field argument is specified as a document path. It can be a simple field name, but it can be a more complex expression like $.foo.bar[3]
. One consequence of this is that document field names that contain spaces or other special characters need to be quoted, for example one needs to use this form
.unset("\"field name with spaces\"")
as .unset("field name with spaces")
would be an invalid document path expression.
Note also that wildcard paths that use *
or **
are not valid for these operations that modify documents.
See MySQL Reference Manual for more information on document path syntax supported by MySQL server.
Apply JSON Patch to a target JSON document.
The JSON Patch format is defined by RFC7386.
A document patch is similar to a JSON object, with the key difference that document field values can be nested expressions in addition to literal values.
The patch contains instructions of how the source document is to be modified producing a derived document. By default, all fields from the source document are copied to the resulting document. If patch sets a field to NULL, the field of that name in the source is skipped from the result, identifiers and function calls are evaluated against the original source document.