【问题标题】:sql array does not work (background: nodejs with postgresql)sql 数组不起作用(背景:nodejs 与 postgresql)
【发布时间】:2017-05-09 00:34:43
【问题描述】:

我是 nodejs 和 postgresql 的新手

背景:nodejs api 数据库:postgresql

数据表:company_apps 列:状态 作为流图 http://take.ms/jqIpA

我想获取状态为“D”或“P”的数据,例如

select * from company_apps where status in ('D','P')

我尝试使用数组来设置过滤器,但它不起作用。 作为流图 http://take.ms/dbpP7

【问题讨论】:

标签: sql node.js postgresql


【解决方案1】:

您使用的是 Massive,而 {$in: [value1, value2]} 的语法不正确——如果字段值为数组,Massive 会自动生成 IN 子句,因此您只需设置 filter.status = ['D', 'P']docs有更多信息。

并且请将代码发布为代码,而不是图片。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-06-30
    • 1970-01-01
    • 2011-01-24
    • 2013-01-01
    • 2023-03-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多