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.
mongodb查询:
db.essay.find({_id:{$lt:ObjectId("551d558aebce3712baa9f2a8")}}).sort({_id:-1}).limit(1)
我想在和尚中使用它,我不知道该怎么做。
尝试:
var monk = require('monk'); var db = monk('localhost:27017/mydb'); var collection = db.get('essay'); collection.find( { _id: { $lt: ObjectId("551d558aebce3712baa9f2a8") } }, { limit: 1, sort: { _id : -1 } }, function (err, obj) { } );