使用从模型的远程方法中查找时的环回顺序filter,错误:

在远程方法中查找时,我正在用一个简单的sortingfilter很难:

/** * This remote method exposes the meals history from the current logged in user */ Meal.listMeals = function(req, res, cb) { Meal.find({ where: {patientId: req.accessToken.userId}, order: {mealDate: 'DESC'} }, cb); }; Meal.remoteMethod('listMeals', { returns: {arg: 'meals', type: 'array'}, http: {path:'/list-meals', verb: 'get'}, accepts: [ {arg: 'req', type: 'object', http: {source: 'req'}}, {arg: 'res', type: 'object', http: {source: 'res'}} ] }); 

上面你看到我的远程/查找实现,它没有顺序filter正常工作..一旦我添加oder {mealDate:'DESC'}我得到一个错误:

订单{“mealDate”:“DESC”}无效

mealDate是我的模型上的datetypes。

 "properties": { "mealDate": { "type": "date", "required": true, "default": "Date.now" }, 

任何想法可能是什么问题? 我一直坚持这一段时间,我想解决scheme很简单..

PS – 我知道我可以在数组中直接使用sorting来做到这一点,但我试图在这种情况下使用回送filter。

基于文档 ,我认为应该是这样的:

 Meal.find({ where: {patientId: req.accessToken.userId}, order: 'mealDate DESC' }, cb);