Item.find().sort([['_id','descending']]).limit(15).each(function(doc) {
  client.send(JSON.stringify(doc));
});

返回此错误:
Error: Error: Illegal sort clause, must be of the form [['field1', '(ascending|descending)'], ['field2', '(ascending|descending)']]\n

有任何想法吗?谢谢!

最佳答案

Item.find().sort('_id','descending').limit(15).each(function(err, doc) {
client.send(JSON.stringify(doc));
});

关于node.js - MongoDB/Mongoose 排序错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5679296/

10-08 22:27