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

Querying for documents containing the field "errmsg" raises a Mongo::Error::OperationFailure

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 2.0.6
    • Fix Version/s: 2.1.0
    • Component/s: None
    • Labels:
      None
    • # Replies:
      7
    • Last comment by Customer:
      true

      Description

      Querying a collection for documents may raise a Mongo::Error::OperationFailure if the first document return contains an "errmsg" field.

      From the code of the driver, I expect the same to be true of "err" and "$err".

      Stacktrace:

      Mongo::Error::OperationFailure: "whatever the content of 'errmsg' is."
        from /app/vendor/bundle/ruby/2.1.0/gems/mongo-2.0.6/lib/mongo/operation/result.rb:214:in `validate!'
        from /app/vendor/bundle/ruby/2.1.0/gems/mongo-2.0.6/lib/mongo/operation/read/query.rb:62:in `block in execute_message'
        from /app/vendor/bundle/ruby/2.1.0/gems/mongo-2.0.6/lib/mongo/server/connection_pool.rb:99:in `with_connection'
        from /app/vendor/bundle/ruby/2.1.0/gems/mongo-2.0.6/lib/mongo/server/context.rb:63:in `with_connection'
        from /app/vendor/bundle/ruby/2.1.0/gems/mongo-2.0.6/lib/mongo/operation/read/query.rb:61:in `execute_message'
        from /app/vendor/bundle/ruby/2.1.0/gems/mongo-2.0.6/lib/mongo/operation/read/query.rb:55:in `execute'
        from /app/vendor/bundle/ruby/2.1.0/gems/mongo-2.0.6/lib/mongo/collection/view.rb:164:in `send_initial_query'
        from /app/vendor/bundle/ruby/2.1.0/gems/mongo-2.0.6/lib/mongo/collection/view/iterable.rb:39:in `each'
      

      Example document:

      { "errmsg": "whatever the content of 'errmsg' is." }
      

      I think it would be prudent to also check for the presence of other fields to determine if this is really an OperationFailure (maybe adding an extra check for "ok" == 0, however, it's still not bulletproof.)

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since reply:
                3 years, 3 weeks, 5 days ago
                Date of 1st Reply: