我正在使用 Azure Node.js SDK,但无法让此查询正常工作:
var ts1 = azure.createTableService(config.storageAccount, config.storageAccessKey, config.tableHost);
var query = azure.TableQuery
.select()
.from('users')
.where('PartitionKey eq ?', '0')
.and('FriendsSeeVideo eq ?', 'true')
.and('Status eq ?', 'Active');
var firstTimeThrough = true;
for (f in friends){
if (firstTimeThrough){
query.and('UserID eq ?', friends[f].id);
firstTimeThrough = false;
}
else query.or('UserID eq ?', friends[f].id);
}
当我将查询写入屏幕时,我得到一个如下所示的 Azure 表查询:
query = {"_fields":[],"_from":"users","_where":["PartitionKey eq '0'"," and FriendsSeeVideo eq 'true'"," and Status eq 'Active'"," and UserID eq '763424639'"," or UserID eq '1385552681'"," or UserID eq '100001386550915'"," or UserID eq '100001869159941'"],"_top":null,"_partitionKey":null,"_nextPartitionKey":null,"_rowKey":null,"_nextRowKey":null}
但它没有返回我期望的结果。有 1 个用户满足表存储条件,结果应该返回用户 ID 为 763424639 的用户,但不是吗?
基本上,我传入一个朋友集并询问表存储这些人是否存在于用户表中,如果他们启用了 FriendsSeeVideo 设置,则返回他们。
谁能看到我做错了什么?