-
Type:
New Feature
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: Aggregation Framework
-
None
-
Fully Compatible
-
Query 2019-04-22, Query 2019-05-06
-
None
-
None
-
None
-
None
-
None
-
None
-
None
This stage replaces the new modes of $out.
The syntax is:
{$merge: {
into: "collection name" OR {db: "db name", coll: "collection name"},
on: <fields used to uniquely identify a document>,
let: <optional, variables to be in scope for pipeline below>,
whenMatched: "replace|keepExisting|fail|merge|pipeline",
whenNotMatched: "insert|discard|fail"
}}
This ticket tracks support for the combination of modes already supported by $out:
mode "insertDocuments":
{$merge: {
into: "x",
on: "x_id"
whenMatched: "fail",
whenNotMatched: "insert"
}}
mode "replaceDocuments":
{$merge: {
into: "x",
on: "x_id"
whenMatched: "replaceWithNew",
whenNotMatched: "insert"
}}
Support for other modes is tracked in their own tickets.
- is depended on by
-
SERVER-40430 Add $merge support for whenMatched: 'merge'
-
- Closed
-
-
SERVER-40431 Add $merge support for whenMatched: pipeline
-
- Closed
-
-
SERVER-40438 Add $merge support for whenNotMatched: "fail"
-
- Closed
-
-
SERVER-40439 Add $merge support for whenNotMatched: "discard"
-
- Closed
-
-
SERVER-40440 Add $merge support for whenMatched: 'keepExisting'
-
- Closed
-
-
SERVER-41175 Ensure $merge is not allowed in $lookup sub-pipelines
-
- Closed
-
- is related to
-
SERVER-2517 Allow mapReduce to create full documents
-
- Closed
-