0

I am facing the problem of this. If I want to apply this kind of filter in loopback restful api filter.

between(0,7) or between(11,17) or between(21,27)

How to write the filter script?

Louis Luk
  • 303
  • 2
  • 16

1 Answers1

0

In code:

var myFilter = {
  where: {
        or: [{
            val: {
                between: [0, 7]
            }
        }, {
            val: {
                between: [11, 17]
            }
        }, {
            val: {
                between: [21, 27]
            }
        }]
    }
};

MyModel.find(myFilter, function (err, instances) {
  // Code to apply on found instances 
});

You can use a stringified JSON version of a filter in your REST queries.

Ivan Schwarz
  • 814
  • 1
  • 14
  • 22