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) { } );