Node.js 猫鼬下对象

Node.js 猫鼬下对象,node.js,mongodb,mongoose,Node.js,Mongodb,Mongoose,我第一次尝试猫鼬。我似乎找不到与mongodb cursor nextObject等价的东西。此代码: Question.find().sort({date:-1}).nextObject().exec callback 导致 TypeError: Object #<Query> has no method 'nextObject' TypeError:对象#没有方法“nextObject” 我似乎无法通过谷歌或在非常糟糕的猫鼬文档中找到任何关于这一点的信息。要查找最新

我第一次尝试猫鼬。我似乎找不到与mongodb cursor nextObject等价的东西。此代码:

    Question.find().sort({date:-1}).nextObject().exec callback
导致

TypeError: Object #<Query> has no method 'nextObject'
TypeError:对象#没有方法“nextObject”

我似乎无法通过谷歌或在非常糟糕的猫鼬文档中找到任何关于这一点的信息。

要查找最新或最旧的,您是否可以使用
findOne
sort
配对

// finds the question with the most recent date
Question.findOne().sort({date: -1}).exec(function(err, question) {
    // ...
});

// finds the question with the oldest date
Question.findOne().sort({date: 1}).exec(function(err, question) {
    // ...
});

请问您为什么需要访问
nextObject()
函数?您只是想找到一个与您的查询匹配的文档吗?在本例中,我要查找数据库中最重要的结果、最新或最旧的问题。