Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Loopback neq: null

I'm trying a query on a postgres database through the loopback api explorer:

{"where": {"archived_at":{ "neq": null }}}

However, I only get results where archived_at is null?

like image 413
Bunker Avatar asked May 15 '15 15:05

Bunker


2 Answers

The following query worked for me...

{ "include": [ "currency" ], "where": { "currencyCode": { "neq":  null } } }

I was requesting tables that had a currencyCode...

(Sorry for the poor quality of my response, I just wanted to share, even I didn't have a straight answer to the OG's question, and I don't have enough props to comment)

like image 144
Peter Andreas Moelgaard Avatar answered Nov 17 '22 21:11

Peter Andreas Moelgaard


It depends on the database. Based on postgresql in loopback 3.

For search integer / number null or not null value.

I think it depends on the database and loopback version.

  1. You can try like nlike query in loopback (but how to use it depends on the db) https://loopback.io/doc/en/lb3/Where-filter.html#ilike-and-nilike

  2. Querying not null value

    Explorer:

    {"where": {"principalId": { "neq": "" }} }
    

    or in server

    {where: {"principalId": { neq: "" }} }
    
  3. Try to direct query in database. Loopback allowed for that.

    "angular": "^1.6.3",
    "angular-messages": "^1.6.3",
    "angular-ui-validate": "^1.2.2",
    "async": "^2.1.5",
    "bower": "^1.8.0",
    "compression": "^1.6.2",
    "cors": "^2.8.1",
    "helmet": "^3.5.0",
    

"loopback": "^3.7.0",

"loopback-boot": "^2.23.0",
"loopback-component-explorer": "^4.2.0",
"

loopback-component-storage": "^3.2.0",

"loopback-connector-mongodb": "^3.0.1",
"loopback-connector-mysql": "^3.0.0",
"loopback-connector-postgresql": "^2.8.0",
"loopback-console": "^1.1.0",
"loopback-datasource-juggler": "^3.5.0",
"loopback-sdk-angular-cli": "^3.0.0",
"milligram": "^1.3.0",
"serve-favicon": "^2.4.2",
"strong-error-handler": "^2.0.0"
like image 1
White Dragon Avatar answered Nov 17 '22 19:11

White Dragon