Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这个查询
var startVal = Math.random(); db.coll.find({r: {$gt: startVal}}).sort({r: 1}).limit(1);
让我绊倒的是那种。谁能帮我将此查询转换为 C++ 查询?
谢谢!
应该:
QUERY("r" << BSON("$gt" << startVal ) ).sort("r" << 1)
甚至更简单:
QUERY("r" << GT << startVal ).sort("r")
limit表示为执行查询的调用的一部分(第 3 个参数)
limit
auto_ptr<DBClientCursor> cursor = c.query("DB.coll", QueryHere, 1);