Search code examples
javascriptmysqlloopbackjsbetween

Using between in loopback like in mysql


Somebody knows if it is possible to create a query using "between" in loopback?, something similar to this:

select ...
 where value BETWEEN column1 and column2

because the loopback documentation explains how to use "between", but of this way:

{where: {size: {between: [0,7]}}}, // where column between value and value 

Thanks.


Solution

  • According to this: https://loopback.io/doc/en/lb2/Where-filter.html#node-api

    A where query in loopback in constructed with structure {where: {property: {op: value}}} and they say value is a literal value

    To achieve what you're doing, executing native SQL would be your best bet: https://loopback.io/doc/en/lb2/Executing-native-SQL.html