简体   繁体   English

Azure表存储:如何使用NodeJS库对AND和OR查询进行分组?

[英]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.

相关问题 如何在NodeJS中为天蓝色表存储创建高级查询? - How to create advanced queries for azure table storage in NodeJS? 如何在 NodeJS 中对 Azure 表存储进行 PUT 或 DELETE? - How to do a PUT or DELETE for Azure Table Storage in NodeJS? 如何使用NodeJ在Azure存储表中的组/多个/批量插入中实现REST API? - How to implement REST API using NodeJs for group/multiple/batch insert in table of azure storage? 如何使用新的 NodeJS @azure/storage-queue 库连接到开发 Azure 存储(本地)? - How to connect to Development Azure Storage (local) with the new NodeJS @azure/storage-queue library? 如何在运行时应用具有Node.js Azure函数命中表存储的筛选器? - How do you apply a filter at runtime with a node.js Azure Function hitting Table Storage? 如何使用node.js Azure函数击中Table Storage来执行upsert? - How do you perform an upsert with a node.js Azure Function hitting Table Storage? 如何在Azure移动服务中从SQL切换到表存储? - How do you switch from SQL to Table Storage in Azure Mobile Services? Azure表存储:将C#转换为NodeJS-如何使用CompareTo? - Azure Table Storage: Translate C# to NodeJS - How to use CompareTo? Azure 使用 NodeJs SDK 的表存储故障转移 - Azure table storage failover using NodeJs SDK nodejs根据时间戳查询azure存储表 - nodejs query azure storage table according to timestamp
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM