2012-10-17 108 views
0

这是简单的脚本。Mongo :: ReplSetConnection验证失败

require 'mongo' 
database=Mongo::ReplSetConnection.new(["database1:9900", "database2:9900","database3:9900"]).db("project") 
database.authenticate("user","passwd") 

我得到了以下错误:

undefined local variable or method `pools' for # <Mongo::ReplSetConnection:0x0000000441e610> 
from /home/tommy/.rvm/gems/[email protected]/gems/mongo-1.7.0/lib/mongo/repl_set_connection.rb:309:in `authenticate_pools' 

有没有人遇到过这样的问题吗?有什么建议吗?

回答

0

以下方法适用于我。但我不知道为什么。

con=Mongo::ReplSetConnection.new(["host1:14000", "host2:14000", "host3:14000"]) 
con.add_auth("databasename","user","passwd") 
con.apply_saved_authentication()