Details
-
Task
-
Status: Closed
-
Major - P3
-
Resolution: Fixed
-
None
-
None
-
2
-
KANBAN BUCKET
Description
Description
Document the updated syntax for the $out aggregation stage. The specific syntax has changed between 4.1.1 and 4.1.2, with additional functionality added in 4.1.3. Some functionality may have been backported to 4.0.x. Check the corresponding server ticket for each $out related change to look for any backport work done.
The current syntax for $out is:
{ $out : <collection name> }
|
Based on the technical design in WRITING-1983 and the updates in SERVER-36286 (4.1.2) ( based on this code chunk ), the updated syntax for $out should be:
{
|
$out: {
|
to : <string collection name>,
|
mode : "insertDocuments" | "replaceDocuments" | "replaceCollection", |
db : "<destination database, if different from current db>", |
uniqueKey: { optional document of fields that identifies a document for replacement or merge } |
}
|
}
|
WRITING-1983 contains significant amounts of behavioral descriptions that should be taken into account when updating the current $out page. Take special care when documenting the behavior of uniqueKey.
As of SERVER-36123, $out does not support outputting to a sharded collection if mode : "replaceCollection
As of SERVER-18027, $out does support outputting to a sharded collection if mode : "insertDocuments|replaceDocuments"
SERVER-35954, SERVER-36100, SERVER-36424: describes the behavior of the optional uniqueKey field for sharded collections
Other tickets may come through related to additional behavior of $out. There's some confusion over exactly what versions behavior has been ported to. Focus on what is going into 4.2, but make note of any features (e.g. SERVER-36123) that have been marked with a 4.0.x fix version. Confirm with the engineers what features specifically will/have been backported, if any.
See https://jira.mongodb.org/browse/PM-828 for a complete list of all tickets related to $out
Scope of changes
-
- You can find the source file in source/reference/operator/aggregation/out.txt
- Use https://docs.mongodb.com/manual/reference/operator/aggregation/lookup/ as a model to work off of
- You can find the source file in source/reference/operator/aggregation/lookup.txt. Take note of how we use .. include:: directive and the files it points to, how they are structured, etc.
Attachments
Issue Links
- is related to
-
DOCS-11892 Docs for SERVER-35893: Update $out to accept new syntax
-
- Closed
-
-
DOCS-11943 Docs for SERVER-36286: Rename options for new $out
-
- Closed
-
-
DOCS-11948 Docs for SERVER-35896: Support "replaceDocuments" mode in $out
-
- Closed
-
-
DOCS-11961 SERVER-36123: Reject $out with mode: "replaceCollection" if the output collection is sharded
-
- Closed
-
-
DOCS-12015 Docs for SERVER-36424: Make sure $out's uniqueKey is unique when target collection is unsharded
-
- Closed
-
-
DOCS-12017 Docs for SERVER-36100: Allow missing "_id" from extracted unique key in a $out pipeline
-
- Closed
-
-
DOCS-12018 Docs for SERVER-35954: Build uniqueKey from the shard key if not present in user command
-
- Closed
-
-
DOCS-12024 Docs for SERVER-18027: Support aggregation $out to sharded collection
-
- Closed
-
-
DOCS-12025 Docs for SERVER-13201: Allow new Aggregation $out operator to explicitly name a DB to write to
-
- Closed
-
-
DOCS-12052 Docs for SERVER-36367: Add validation checks for $out uniqueKey
-
- Closed
-