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

Mongo::Server::Description#standalone? is always false

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • 2.0.0
    • Affects Version/s: None
    • Component/s: None
    • None

      What I do:

      @connection = Mongo::Client.new(
        ["localhost:27017"],
        :pool_size => 10,
        :database => "db_name"
      )
      
      @collection = @connection.use(@database_name).database["sunspot_index_queue_entries"]
      @collection.indexes.ensure(:record_class_name => Mongo::Index::ASCENDING, :record_id => Mongo::Index::ASCENDING)
      

      What I get:

      ~/.rvm/gems/ruby-2.1.2@carmen/bundler/gems/mongo-ruby-driver-9c8b06c2d694/lib/mongo/server_preference/selectable.rb:82:in `block in primary': undefined method `primary?' for nil:NilClass (NoMethodError)
              from ~/.rvm/gems/ruby-2.1.2@carmen/bundler/gems/mongo-ruby-driver-9c8b06c2d694/lib/mongo/server_preference/selectable.rb:82:in `select'
              from ~/.rvm/gems/ruby-2.1.2@carmen/bundler/gems/mongo-ruby-driver-9c8b06c2d694/lib/mongo/server_preference/selectable.rb:82:in `primary'
              from ~/.rvm/gems/ruby-2.1.2@carmen/bundler/gems/mongo-ruby-driver-9c8b06c2d694/lib/mongo/cluster.rb:110:in `next_primary'
              from ~/.rvm/gems/ruby-2.1.2@carmen/bundler/gems/mongo-ruby-driver-9c8b06c2d694/lib/mongo/index/view.rb:107:in `ensure'
      

      The problem (in Mongo::Server::Description):

      def standalone?
        replica_set_name.nil? && !mongos? && !ghost? && !unknown?
      end
      

      This part !unknown? is always false because in Mongo::Server you do:

      @description = Description.new(self) # not passing any config
      

      And the unknown? method checks exactly for empty configs.

            Assignee:
            durran.jordan@mongodb.com Durran Jordan
            Reporter:
            alexs Alexander S.
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: