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

XMLWordPrintableJSON

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

      > 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 Stearn
              Reporter:
              Mathias Stearn
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: