I need to sort "datetime" ascending format. But getting an error "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);
Thanks.
The syntax would be:
const query = { your: 'query' };
const options = { sort: { datetime: 1 } };
const results = Requests.find(query, options).fetch();
Have a look at the docs.