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

findAndModify should report that remove and update options conflict

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • 3.0.0-rc6
    • 2.8.0-rc3
    • 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}});

    Description

      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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: