【问题标题】:Mongo::Error::NoServerAvailable in Rails 5 app development environmentRails 5 应用程序开发环境中的 Mongo::Error::NoServerAvailable
【发布时间】:2017-06-15 17:17:30
【问题描述】:

我正在尝试通过rails console 连接到现有的 mLab 数据库。每次我查询(例如GameScore.all.countUser.all.count)时,都会返回以下错误消息:

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:password@host:port/db_name'
      options:
        consistency: :strong
        max_retries: 30
        retry_interval: 1
        timeout: 15

不胜感激。现在真的很困惑。

【问题讨论】:

  • 已解决。不得不降级到 Rails 4.2.7 和 mongoid 4。就像一个魅力。

标签: ruby-on-rails mongodb mongoid mlab


【解决方案1】:

已解决。不得不降级到 Rails 4.2.7 和 mongoid 4。工作就像一个魅力。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-10-17
    • 2014-11-02
    • 1970-01-01
    • 1970-01-01
    • 2017-05-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多