This commit allows user to specify an aggregation pipeline to an update command for the "u" argument. It supports the $addFields, $project and $replaceRoot stages and allows users to manipulate documents using these stages and aggregation expressions.
Extend the update command to take an object or an array:
For this task, the only supported stages will be $addFields, $project, and $replaceRoot.
For this task, we should ban other options such as 'collation', 'bypassDocumentValidation', 'writeConcern', 'arrayFilters'. All except 'arrayFilters' will eventually be supported, but will be tracked by separate tickets.
*note* : per
DOCS-12724 – it is available with*OUT* feature flag.
- source/reference/command/update and associated args file
- source/reference/method/db.collection.update.txt and associated args file
- source/reference/method/db.collection.updateOne.txt and associated args file
- source/reference/method/db.collection.updateMany.txt and associated args file (although not yet changed)
- /tutorial/update-documents under CRUD section – only mentioning at end as a blurb since this page is mostly a beginner page
- Bulk Write Operations –
- /db.collection.bulkWrite() ref page but have them refer to the updateOne() and updateMany() page for details. No specific example.
- /core/bulk-write-operations - Didn't mention it since the page refers to the bulkWrite page for the updates which mentions the change
- Bulk.find.updateOne() and Bulk.find.update() – only modify the parameter table to prefer the bulkWrite()
- some files to consolidate content regarding the agg availability for findAndModify and updates
The update page needs overhaul, particularly in the examples section to
be more cohesive. This will not be tackled as part of this feature
ticket. Instead, will be handled separately, like we did the find page.