2013-03-28 76 views
1

我有一个集合中有两个计数器字段的文档。想要查找counter1计数大于counter2计数的文档。如何在查询查询中将counter2键作为变量传递?我想是这样的......MongoDB查找基于文档密钥

db.collection.find({ counter1: { $gt: counter2 }}) 

回答