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

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 1.9.0
    • None
    • Write Ops
    • None
    • MongoDB 1.6.5
    • Minor Change

    Description

      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

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: