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

Investigate changes in SERVER-38909: Permit empty update modifiers, treating as a no-op rather than an error



    • Task
    • Status: Closed
    • Major - P3
    • Resolution: Done
    • None
    • 4.7.0, 4.0.25, 4.2.15, 4.4.7
    • manual, Server
    • None
    • 3
    • ServerDocs2020: Jan12 - Jan19, ServerDocs2020: Jan19 - Jan26, ServerDocs2020: Feb23 - Mar2, ServerDocs2020: Mar2 - Mar9
    • true



      Downstream Change Summary

      Changed the behavior of "update" and "findAndModify" commands. All update modifiers allow an empty spec (i.e. {$pop: {}}, {$min: {}}, {$set: {}}, {$unset: {}}) now. Flagging for review.

      Description of Linked Ticket

      As a few people have mentioned onĀ SERVER-12266, the change to throw errors on empty updates is highly disruptive and has kept me from updating for a long time. I'm finally in a position in which I need to move to a more recent version of MongoDB and have followed the lead of others in writing an application layer that detects empty patches and aborts the call to MongoDB in those cases. But, in doing so, I'm struck by the absurdity of the application needing to include code for that. Surely it would be much more efficient to implement such functionality within MongoDB, perhaps enabled by a run-time flag? Or perhaps a default, and disabled only via a run-time flag, since I'm sure that the people who want empty patches to work vastly outnumber those who want them to fail. I guess that this could also be a client option.

      An action triggered via an option on a patch request to a database-driven service is a very common thing. The success of the operation is seldom desired to be contingent on the presence of patch data, and there are probably millions of lines of code in the world that work around Mongo's inconsistent treatment of empty and non-empty patches. It would be great to be able to remove them.

      Scope of changes

      Impact to Other Docs

      MVP (Work and Date)

      Resources (Scope or Design Docs, Invision, etc.)


        Issue Links



              naomi.pentrel@mongodb.com Naomi Pentrel (Inactive)
              backlog-server-pm Backlog - Core Eng Program Management Team
              Jess Mokrzecki Jess Mokrzecki
              0 Vote for this issue
              3 Start watching this issue


                2 years, 2 weeks, 4 days ago