使用Mongoid 3.1执行自定义命令

时间:2013-05-07 14:20:30

标签: ruby-on-rails ruby mongoid3

我正在尝试在Mongoid 3.1下运行自定义javascript命令

User.collection.database.session.cluster.with_primary do
    p User.collection.database.command(eval: 'function() { return 3+3; }')
end

我只有这个错误:

Moped::Errors::ConnectionFailure: Could not connect to a primary node for replica set   <Moped::Cluster nodes=[<Moped::Node resolved_address="127.0.0.1:27017">, <Moped::Node resolved_address="127.0.0.1:27018">, <Moped::Node resolved_address="127.0.0.1:27019">]>

0 个答案:

没有答案