在文档中,Strongloop没有讨论常见的情况:使用带有Order过滤器的WHERE过滤器。
示例:Customers WHERE name='John' ORDER BY 'birthdate' DESC LIMIT 5
Customers.find({where:{'userId':'John'},{order:'birthdate DESC',limit:5}},...
任何人都有正确的语法?它运行但它没有给出正确的答案。它没有应用ORDER过滤器,也没有应用限制过滤器。
谢谢
答案 0 :(得分:1)
Order和limit是发送对象发送的两个属性,您将limit和order合并到一个子文档中。你应该使用:
Customers.find({
where: { 'userId': 'John' },
order: 'birthdate DESC', //can take array of string if multiple order
limit: 5
});