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

FindAndModify doesn't work if sort is used and _id in query

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.7.6
    • Affects Version/s: None
    • Component/s: Write Ops
    • None
    • ALL

      > db.testcollection.find()

      { "_id" : 1, "priority" : 2, "inprogress" : false, "name" : "abc" }

      > db.runCommand({
      ... findandmodify : "testcollection",
      ... query :

      { _id : 1 }

      ,
      ... sort :

      { priority : -1 }

      ,
      ... update : { $set :

      { inprogress : true, started : Date() }

      },
      ... new : true
      ... })
      {
      "value" :

      { "_id" : 1, "priority" : 2, "inprogress" : false, "name" : "abc" }

      ,
      "ok" : 1
      }
      > db.testcollection.find()

      { "_id" : 1, "priority" : 2, "inprogress" : false, "name" : "abc" }

      >

            Assignee:
            mathias@mongodb.com Mathias Stearn
            Reporter:
            mathias@mongodb.com Mathias Stearn
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: