Search code examples
mongodbloopbackjs

Mathematical expression for Loopback 3 between query on MongoDB


I'm using loopback 3 and MongoDB.

Loopback 3 has between operator and I use it as follows.

whereQuery.progress = { between: [25, 50] };

Which is the correct mathematical expression for above and why?

  1. 25 < progress < 50
  2. 25 ≤ progress < 50
  3. 25 ≤ progress ≤ 50
  4. 25 ≤ progress ≤ 50

Solution

  • It is 25 ≤ progress ≤ 50.

    Quoting from the linked docs:

    True if the value is between the two specified values: greater than or equal to first value and less than or equal to second value.