【问题标题】:How can I write an OR condition using node-orm2?如何使用 node-orm2 编写 OR 条件?
【发布时间】:2013-03-24 16:58:07
【问题描述】:

有可能做这样的事情吗?

User.find({'$or': [{user_id: 1}, {user_id: 2}]}, function(err, items){

}

【问题讨论】:

    标签: node.js orm


    【解决方案1】:

    是的,对于 node-orm2,您可以使用“或”找到。

    例子:

    User.find({
            user_id : [ "1", "2" ]
    })
    

    这将返回 used_id = 1 或 used_id = 2 的对象。这就像一个“IN”条件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多