2017-01-30 53 views
0

我試圖通過rails console連接到現有的mLab數據庫。每次我查詢(例如GameScore.all.countUser.all.count),我被返回以下錯誤消息:Mongo :: Error :: NoServerAvailable在Rails 5應用程序開發環境中

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' 

下面是我的mongoid.yml文件已設置:

development: 
    clients: 
    default: 
     uri: 'mongodb://username:[email protected]:port/db_name' 
     options: 
     consistency: :strong 
     max_retries: 30 
     retry_interval: 1 
     timeout: 15 

希望得到任何幫助。現在真的難住了。

+0

已解決。必須降級到Rails 4.2.7和mongoid 4.像魅力一樣工作。 – fish

回答

0

已解決。必須降級到Rails 4.2.7和mongoid 4.像魅力一樣工作。

相關問題