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

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.9.0
    • Component/s: Write Ops
    • Labels:
      None
    • Environment:
      MongoDB 1.6.5
    • Backwards Compatibility:
      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

            Assignee:
            redbeard0531 Mathias Stearn
            Reporter:
            alaz Alexander Azarov
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: