MongoDB 请教大家 1.12.x 版本中,报 NameError: uninitialized constant MongoReplicaSetClient

ghn645568344 · 2016年12月19日 · 最后由 ghn645568344 回复于 2016年12月20日 · 6490 次阅读

之前项目中用的是 1.12.3 版本的 mongo gem,后来升级 mongo gem 后发现之前版本的链接方式都换了,想再退回到 1.12.3 版本的 GEM 但使用副本集的时候

client =MongoReplicaSetClient.new(['123.57.xxx.xxx:30000', '123.56.xxx.xxx:30000', '101.201.xxx.xxx:30000'])

链接时报😭

NameError: uninitialized constant MongoReplicaSetClient
    from (irb):3
    from /home/haonan/.rvm/gems/ruby-2.1.4/gems/railties-4.2.3/lib/rails/commands/console.rb:110:in `start'
    from /home/haonan/.rvm/gems/ruby-2.1.4/gems/railties-4.2.3/lib/rails/commands/console.rb:9:in `start'
    from /home/haonan/.rvm/gems/ruby-2.1.4/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:68:in `console'
    from /home/haonan/.rvm/gems/ruby-2.1.4/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /home/haonan/.rvm/gems/ruby-2.1.4/gems/railties-4.2.3/lib/rails/commands.rb:17:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

网上各种查,没找到好的办法,请假大家了🙏

MongoReplicaSetClient ? 这是什么东西,那里来的,你为什么会用它?

#1 楼 @huacnlee 看官网 1.X 文档,链接其他副节点用的😖

需要 登录 后方可回复, 如果你还没有账号请 注册新账号