-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Labels:None
Description
Description:
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.
Engineering Ticket Description:
Extend the update command to take an object or an array:
{ update: <collection>, updates: [ { q: <query>, u: <update obj OR update pipeline>, upsert: <boolean>, multi: <boolean>, collation: <document>, arrayFilters: <array> }, { q: <query>, u: <update obj OR update pipeline>, upsert: <boolean>, multi: <boolean>, collation: <document>, arrayFilters: <array> }, ... ], ordered: <boolean>, writeConcern: { <write concern> }, bypassDocumentValidation: <boolean> }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.
Scope of changes
- 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)
- source/release-notes/4.2.txt
- /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
Out of Scope
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.
Impact to Other Docs
MVP (Work and Date)
Resources (Scope or Design Docs, Invision, etc.)
- documents
-
SERVER-40381 Add the ability to specify a pipeline to an update command
- Closed
- related to
-
DOCS-12688 Docs for SERVER-40408: Add pipeline versions of update helpers in the shell
- Closed