Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-12627

Docs for SERVER-40381: Add the ability to specify a pipeline to an update command



    • Task
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 4.1.11
    • manual, Server
    • None




      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.)


        Issue Links



              kay.kim@mongodb.com Kay Kim (Inactive)
              kay.kim@mongodb.com Kay Kim (Inactive)
              Kay Kim Kay Kim (Inactive)
              0 Vote for this issue
              1 Start watching this issue


                3 years, 24 weeks, 5 days ago