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

OperationFailure on index iteration

    • Type: Icon: Task Task
    • Resolution: Works as Designed
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.5.1
    • Component/s: None
    • Labels:
      None
    • Environment:
      jruby 9.1.12.0
      mongoid 5.2.1
      mongo 2.5.1

      I get Mongo::Error::OperationFailure: no collection (26) when I iterate over indexes on a newly created collection

      Example:

      require 'mongo'
      Mongo::Logger.logger.level = ::Logger::INFO
      client = Mongo::Client.new(['127.0.0.1'], database: :development)
      collection = client[:any_coll]
      indexes = collection.indexes
      indexes.each do |i|
         puts i 
      end
      

      Error stacktrace:

      Mongo::Error::OperationFailure: no collection (26)
      	from /Users/louisajaca/.rvm/gems/jruby-9.1.12.0@cc/gems/mongo-2.5.1/lib/mongo/operation/commands/list_indexes/result.rb:82:in `validate!'
      	from /Users/louisajaca/.rvm/gems/jruby-9.1.12.0@cc/gems/mongo-2.5.1/lib/mongo/operation/executable.rb:40:in `block in execute'
      	from /Users/louisajaca/.rvm/gems/jruby-9.1.12.0@cc/gems/mongo-2.5.1/lib/mongo/server/connection_pool.rb:110:in `with_connection'
      	from /Users/louisajaca/.rvm/gems/jruby-9.1.12.0@cc/gems/mongo-2.5.1/lib/mongo/server.rb:253:in `with_connection'
      	from /Users/louisajaca/.rvm/gems/jruby-9.1.12.0@cc/gems/mongo-2.5.1/lib/mongo/operation/executable.rb:35:in `execute'
      	from /Users/louisajaca/.rvm/gems/jruby-9.1.12.0@cc/gems/mongo-2.5.1/lib/mongo/operation/commands/indexes.rb:49:in `execute'
      	from /Users/louisajaca/.rvm/gems/jruby-9.1.12.0@cc/gems/mongo-2.5.1/lib/mongo/index/view.rb:271:in `send_initial_query'
      	from /Users/louisajaca/.rvm/gems/jruby-9.1.12.0@cc/gems/mongo-2.5.1/lib/mongo/index/view.rb:195:in `each'
      	from (irb):7:in `<eval>'
      	from org/jruby/RubyKernel.java:1000:in `eval'
      	from org/jruby/RubyKernel.java:1298:in `loop'
      	from org/jruby/RubyKernel.java:1120:in `catch'
      	from org/jruby/RubyKernel.java:1120:in `catch'
      	from /Users/louisajaca/.rvm/rubies/jruby-9.1.12.0/bin/irb:13:in `<main>'
      

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            ljaca Louisa Jaca
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: