postgresql 环回neq:null

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30263367/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 01:54:22  来源:igfitidea点击:

Loopback neq: null

javascriptpostgresqlloopbackjsstrongloop

提问by Bunker

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

我正在尝试通过环回 api 资源管理器对 postgres 数据库进行查询:

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

However, I only get results where archived_at is null?

但是,我只得到 archived_at 为空的结果?

回答by Peter Andreas Moelgaard

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)

(抱歉我的回答质量很差,我只是想分享一下,即使我没有直接回答OG的问题,也没有足够的道具发表评论)

回答by White Dragon

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

这取决于数据库。基于环回 3 中的 postgresql。

For search integer / number null or not null value.

用于搜索整数/数字 null 或非 null 值。

I think it depends on the database and loopback version.

我认为这取决于数据库和环回版本。

  1. You can try like nlikequery 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",
    
  1. 您可以尝试like nlike在环回中查询(但如何使用它取决于数据库)https://loopback.io/doc/en/lb3/Where-filter.html#ilike-and-nilike

  2. 查询非空值

    探险家:

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

    或在服务器中

    {where: {"principalId": { neq: "" }} }
    
  3. 尝试在数据库中直接查询。允许环回。

    "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",

"环回": "^3.7.0",

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

loopback-component-storage": "^3.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"