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

drop method on Collection should not throw if collection does not exist

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 2.0.2
    • 2.0.3
    • Public API
    • None

    Description

      The drop method on Collection, in the shell and most other drivers, trap a failed dropCollection command and check if error message is "ns not found", and if it is, return normally.

      The Ruby driver throws:

      D, [2015-04-01T09:14:55.595000 #59304] DEBUG -- : MONGODB | Adding 127.0.0.1:27017 to the cluster. | runtime: 0.0000ms
      D, [2015-04-01T09:14:55.891000 #59304] DEBUG -- : MONGODB | COMMAND | namespace=admin.$cmd selector={:ismaster=>1} flags=[] limit=-1 skip=0 project=nil | runtime: 113.0002ms
      D, [2015-04-01T09:14:55.900000 #59304] DEBUG -- : MONGODB | COMMAND | namespace=test.$cmd selector={:drop=>"test"} flags=[:slave_ok] limit=-1 skip=0 project=nil | runtime: 3.9999ms
      D, [2015-04-01T09:14:55.905000 #59304] DEBUG -- : MONGODB | COMMAND | namespace=test.$cmd selector={:drop=>"test"} flags=[:slave_ok] limit=-1 skip=0 project=nil | runtime: 3.0000ms
      Mongo::Error::OperationFailure: ns not found ()
              validate! at /Users/jeff/.rvm/gems/jruby-1.7.10/gems/mongo-2.0.2/lib/mongo/operation/result.rb:214
                execute at /Users/jeff/.rvm/gems/jruby-1.7.10/gems/mongo-2.0.2/lib/mongo/operation/command.rb:51
        with_connection at /Users/jeff/.rvm/gems/jruby-1.7.10/gems/mongo-2.0.2/lib/mongo/server/connection_pool.rb:99
        with_connection at /Users/jeff/.rvm/gems/jruby-1.7.10/gems/mongo-2.0.2/lib/mongo/server/context.rb:62
                execute at /Users/jeff/.rvm/gems/jruby-1.7.10/gems/mongo-2.0.2/lib/mongo/operation/command.rb:50
                command at /Users/jeff/.rvm/gems/jruby-1.7.10/gems/mongo-2.0.2/lib/mongo/database.rb:131
                   drop at /Users/jeff/.rvm/gems/jruby-1.7.10/gems/mongo-2.0.2/lib/mongo/collection.rb:94
                 (root) at src/ruby_driver_test.rb:10
      

      Attachments

        Activity

          People

            emily.stolfo Emily Stolfo
            jeff.yemin@mongodb.com Jeffrey Yemin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: