想在lbservices中使用类似查询的角度

时间:2017-01-05 07:49:35

标签: angularjs node.js loopbackjs loopback

我想查询以p开头的所有名称(不区分大小写)。 下面是查询对象,Organization是我生成的lb-service名称

 query = {
            filter: {

                order: 'updatedAt ASC',
                where: {name: {ilike: 'P%'}}
            };
Organisation.find({filter: query.filter})

1 个答案:

答案 0 :(得分:0)

您可以使用regex

Organisation.find({name: {$regex: new RegExp('^P$', "i")}}).sort('updatedAt').all(function(res) {
  //Do your action here..
});