I'm trying to connect to an existing mLab db through
rails console. Everytime I query (e.g
User.all.count), I'm being returned the following error message:
Mongo::Error::NoServerAvailable: No server is available matching preference: #<Mongo::ServerSelector::Primary:0x70240308536180 tag_sets= max_staleness=nil> using server_selection_timeout=30 and local_threshold=0.015 from /Users/-/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/mongo-2.4.1/lib/mongo/server_selector/selectable.rb:115:in `select_server'
Here's how my
mongoid.yml file has been setup:
development: clients: default: uri: 'mongodb://username:[email protected]:port/db_name' options: consistency: :strong max_retries: 30 retry_interval: 1 timeout: 15
Would appreciate any help. Really stumped with this right now.
Resolved. Had to degrade to Rails 4.2.7 and mongoid 4. Worked like a charm.