【问题标题】:Azure Query.where() with orAzure Query.where() with or
【发布时间】:2015-12-18 03:12:33
【问题描述】:

我怎么能做这样的事情:

var userId="patrick";
var finded="bob";
query.where({
    userhostid: userId || finded,
});

我只需要添加到 userhostid quals to userId 或找到的查询项目 谢谢!

【问题讨论】:

    标签: node.js azure azure-mobile-services


    【解决方案1】:

    可以使用指定条件的函数方式:

    var userId="patrick";
    var finded="bob";
    query.where(function(value1, value2) {
        return this.userhostid == value1 || this.userhostid == value2;
    }, userId, finded);
    

    http://blogs.msdn.com/b/carlosfigueira/archive/2012/09/21/playing-with-the-query-object-in-read-operations-on-azure-mobile-services.aspx 的博文包含有关查询中复杂过滤的更多信息。

    【讨论】:

    • 你是我的主人!公升啤酒给你!!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-19
    • 2020-05-17
    • 2016-03-15
    • 2016-06-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多