Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-241

#find_and_modify Error Handling Problems

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 12_01_17
    • Affects Version/s: 1.2.1
    • Component/s: None
    • Labels:
      None
    • Environment:
      Mac OS X 10.6.6; MongoDB 1.6.5; Ruby 1.9.2; Mongo driver for ruby 1.2.4
    • Fully Compatible

      This issue consists of actually two closely related problems.

      1) The #find_and_modify does not support the "safe" option, hence there's no way to make find_and_modify raise an exception when an error is encountered. This also makes it inconsistent with the rest of the find, modification and insert methods.
      2) The #find_and_modify method, when used with the "new" option, causes get_last_error to always report success, even if the update fails. My theory is that get_last_error only works for the last operation in #find_and_modify, so either the "find" if it happens last, or the "update", if it happens last. When the "new" option is given, this obviously causes the "find" operation to happen last, hence any error that occurred during the update operation is overwritten and lost.

            Assignee:
            kbanker Kyle Banker
            Reporter:
            wardrop Tom Wardrop
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: