【发布时间】:2015-05-16 00:15:30
【问题描述】:
我有这个 mongodb shell 命令
db.districts.find({servers:{$exists:true}}, {name:1})
我很难翻译成 ruby mongo 驱动程序语法。
coll = db.collection('districts')
coll.find({"servers"=>{"$exists"=>true}}, {'name'=>1}).to_a
但它抱怨错误 *** RuntimeError 异常:未知选项 [{"name"=>1}]
【问题讨论】: