[英]Azure Table Storage: How do you group AND and OR Queries Utilizing NodeJS Library?
Utilizing the manual editor in Azure Storage Explorer I can create the following query that returns the results I want from the Azure Table Storage: 利用Azure存储资源管理器中的手动编辑器,我可以创建以下查询,该查询从Azure表存储返回我想要的结果:
TYPE eq 'MYTYPE' and (PartitionKey eq '1' or PartitionKey eq '2')
However, I'm not sure how to do this with the NodeJS library. 但是,我不确定如何使用NodeJS库执行此操作。
The following code: 如下代码:
const azure = require('azure-storage');
const svc = new azure.TableService();
var azureQuery = new azure.TableQuery().where("TYPE eq 'MYTYPE'").or("PartitionKey eq '1'").or("PartitionKey eq '2'")
Is equivalent to the query: 等同于查询:
TYPE eq 'MYTYPE' or PartitionKey eq '1' or PartitionKey eq '2'
Likewise I can do the following: 同样,我可以执行以下操作:
const azure = require('azure-storage');
const svc = new azure.TableService();
var azureQuery = new azure.TableQuery().where("TYPE eq 'MYTYPE'").and("PartitionKey eq '1'").or("PartitionKey eq '2'")
But that results in the query: 但这导致查询:
TYPE eq 'MYTYPE' and PartitionKey eq '1' or PartitionKey eq '2'
How do I do the equivalent of parenthesis from the NodeJS library? 我该如何等效于NodeJS库中的括号?
As I known, the simple way is like the code below based on my understanding for the TableQuery
object. 众所周知,根据我对TableQuery
对象的理解,简单的方法类似于下面的代码。
var filter = "TYPE eq 'MYTYPE' and ( PartitionKey eq '1' or PartitionKey eq '2' )"
var azureQuery = new azure.TableQuery().where(filter)
It works fine. 工作正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.