Cosmos DB IN Clause thru REST API

后端 未结 1 1816
[愿得一人]
[愿得一人] 2021-01-21 10:27

I am unable to formulate search query using IN clause for Azure Cosmos document DB

Query

{
  \"query\": \"SELECT * FROM LOA         


        
1条回答
  •  生来不讨喜
    2021-01-21 11:04

    If you use a parameterized IN list with sqlQuerySpec, then it will be considered as a single value when the parameter is expanded.

    Please use convenient way to write your query is to use ARRAY_CONTAINS instead and pass the list of items as a single parameter. Please adjust your query like this:

    SELECT * FROM LOADS l WHERE ARRAY_CONTAINS(@schedulingSystem, l.schedulingSystem,false)
    
     "parameters": [
        {
          "name": "@schedulingSystem",
          "value": "['A','B']"
        }
      ]
    

    Similar question for your references:

    1.https://github.com/Azure/azure-cosmos-dotnet-v2/issues/614

    2.WHERE IN with Azure DocumentDB (CosmosDB) .Net SDK

    0 讨论(0)
提交回复
热议问题