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

findAndModify should only return false if there is an error, not missing doc. findAndRemove throws an exception when no record found

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.9.0
    • Affects Version/s: None
    • Component/s: Write Ops
    • Labels:
      None
    • Environment:
      MongoDB 1.6.5
    • Minor Change

      findAndRemove throws CommandResult.Failure when no record in the collection found. Problems:

      1. Java driver 2.4 returned null in this scenario
      2. The exception has code=-5 which makes it indistinguishable from real errors.

      Test case: https://github.com/alaz/mongo-java-driver/commit/56478bbefdd99fb97a564a449e99772efc08e7b8

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

              Created:
              Updated:
              Resolved: