TypeError:'undefined'在使用mongoDB排序运算符时不是函数

时间:2014-09-18 14:32:28

标签: javascript mongodb meteor

我尝试使用最新日期获取文档,但是我收到此错误:TypeError: 'undefined' is not a function

我的代码:

console.log(Games.find({authorId: authorId}).sort( { releaseDate: -1 } ).limit(1)); // error
console.log(Games.find({authorId: authorId}).fetch()); // expected outpout

(值releaseDate存在且格式为ISODate。) 任何帮助将不胜感激。

编辑:我正在使用Meteor 0.9.2.1。

1 个答案:

答案 0 :(得分:5)

知道了!

Games.find({authorId: authorId}, { sort: { 'releaseDate' : -1 } , limit:1});
相关问题