azure - Postman 中的 Cosmos 查询Where 子句问题

标签 azure azure-cosmosdb azure-cosmosdb-sqlapi

使用 where 子句时,我无法让正文返回结果。它似乎不喜欢 f.RequestPath 的值。

{      
    "query": "SELECT * FROM AppLogs f WHERE f.RequestPath in ("/payments/post-sales", "/payments/pre-sales", "/payments/refunds", "/payments", "/Payments")"
}

Postman Error Message After adding Where clause

只要这样做,查询就可以工作。我认为这可能与 Requestpath 值中的斜杠有关,但不知道如何解决这个问题。需要使用转义字符吗?你会怎么做?任何帮助将不胜感激。

{      
    "query": "SELECT * FROM AppLogs f WHERE 1=1"
}

Query Works without the Where clause for Request Path

最佳答案

请尝试将查询中的双引号替换为单引号。像这样的东西:

{      
    "query": "SELECT * FROM AppLogs f WHERE f.RequestPath in ('/payments/post-sales', '/payments/pre-sales', '/payments/refunds', '/payments', '/Payments')"
}

更新

正如 @MatiasQuaranta 在评论中提到的,您还可以通过执行以下操作来转义查询中的双引号:

"query": "SELECT * FROM AppLogs f WHERE f.RequestPath in (\"/payments/post-sales\", \"/payments/pre-sales\", \"/payments/refunds\", \"/payments\", \"/Payments\")"

关于azure - Postman 中的 Cosmos 查询Where 子句问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75034568/

相关文章:

android - 如何处理Azure移动服务自定义Api返回的android中的多个对象

azure - 是否可以使用cosmos db中的表API通过代码或arm模板在数据库级别提供吞吐量?

c# - CosmosDb - 'PartitionKey extracted from document doesn' t 与 header 中指定的匹配

Azure Cosmos DB 预触发器

azure - 如何根据access_token获取id_token

multithreading - 尝试将 AddMessage 批量添加到 Azure 队列

azure - 构建 Cosmos DB 的哈希 token 签名

Azure CosmosDB REST API 忽略数据浏览器返回的结果

Azure 数据工厂 V2 探索管道依赖性

azure - 从 Azure Cosmos DB 删除查询的文档