Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-16601

findAndModify should report that remove and update options conflict

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.0.0-rc6
    • Affects Version/s: 2.8.0-rc3
    • Component/s: Write Ops
    • None
    • Fully Compatible
    • ALL
    • Hide
      db.foo.drop();
      db.foo.insert({x:1});
      db.foo.findAndModify({query:{x:1}, update:{y:1}, remove:true, sort: {x:1}});
      
      Show
      db.foo.drop(); db.foo.insert({x:1}); db.foo.findAndModify({query:{x:1}, update:{y:1}, remove:true, sort: {x:1}});

      In versions before 2.8.0-RC3, attempting to use update and remove at the same time in findAndModify resulted in an error when sort was specified. This validation appears to have been removed in this commit (perhaps inadvertently).

      With the validation removed, the remove appears to take precedence.

      When sort is not specified, remove always takes precedence without warning the about the conflicting options.

            Assignee:
            dan@mongodb.com Daniel Pasette (Inactive)
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: