merge (
, [ | Object query ]
) {

Recursively merge the result of a query into a local document, overwriting the document with fresh query results. A projection specification may be provided to intelligently merge projected fields.

Arguments

| Object source

Freshly queried state information.

| Object target

The target document to recursively merge into.

optional
| Object query

If the projection uses the positional operator, the query may be included to define its position.

optional
| Object projection

If a projection is provided, the merge will honor any special projection options.