我需要对“datetime”升序格式进行排序。但得到错误“Requests.find(...).sort is not a function
”meteor mini mongo find
var results = Requests.find({
"sp_id": request.sp_id,
"slot": request.slot,
"date": request.date,
"datetime": {
'$gte': request.datetime
},
"status": {
$nin: ['cancel', 'completed']
}
}
).sort({datetime: 1}).fetch();
console.log(results);
感谢。
答案 0 :(得分:3)
语法为:
const query = { your: 'query' };
const options = { sort: { datetime: 1 } };
const results = Requests.find(query, options).fetch();
查看docs。