microsoft / spring-data-cosmosdb

Access data with Azure Cosmos DB
MIT License
94 stars 64 forks source link

Cannot create query with 2 conditions on the same field #374

Open anuraggupta opened 5 years ago

anuraggupta commented 5 years ago

Here my Query

Querying Documents. collectionLink: [dbs/ANS/colls/NOTIFICATION_DATA], querySpec [{\"query\":\"SELECT * FROM ROOT r WHERE r.targetId = @targetId AND CONTAINS(r.targetDevices, @targetDevices) OR r.targetDevices = @targetDevices ORDER BY r.sortTimestamp DESC\"}]

Here is the exception

Caused by: com.microsoft.azure.documentdb.DocumentClientException: Message: {"Errors":["Invalid query. Specified duplicate parameter name '@targetDevices'."]}
ActivityId: 8f3063dc-d4fa-4316-9def-5b1b7d43a3f8, Microsoft.Azure.Documents.Common/2.2.0.0, StatusCode: BadRequest
    at com.microsoft.azure.documentdb.internal.ErrorUtils.maybeThrowException(ErrorUtils.java:74) ~[azure-documentdb-1.16.2.jar:?]
    at com.microsoft.azure.documentdb.internal.GatewayProxy.performPostRequest(GatewayProxy.java:301) ~[azure-documentdb-1.16.2.jar:?]
    at com.microsoft.azure.documentdb.internal.GatewayProxy.doQuery(GatewayProxy.java:133) ~[azure-documentdb-1.16.2.jar:?]
    at com.microsoft.azure.documentdb.internal.GatewayProxy.processMessage(GatewayProxy.java:377) ~[azure-documentdb-1.16.2.jar:?]
    at com.microsoft.azure.documentdb.DocumentClient$10.apply(DocumentClient.java:3145) ~[azure-documentdb-1.16.2.jar:?]
    at com.microsoft.azure.documentdb.internal.RetryUtility.executeDocumentClientRequest(RetryUtility.java:71) ~[azure-documentdb-1.16.2.jar:?]
    at com.microsoft.azure.documentdb.DocumentClient.doQuery(DocumentClient.java:3151) ~[azure-documentdb-1.16.2.jar:?]
    at com.microsoft.azure.documentdb.DocumentQueryClientInternal.doQuery(DocumentQueryClientInternal.java:47) ~[azure-documentdb-1.16.2.jar:?]
    at com.microsoft.azure.documentdb.internal.query.AbstractQueryExecutionContext.executeRequest(AbstractQueryExecutionContext.java:219) ~[azure-documentdb-1.16.2.jar:?]
    at com.microsoft.azure.documentdb.internal.query.DefaultQueryExecutionContext.executeOnce(DefaultQueryExecutionContext.java:158) ~[azure-documentdb-1.16.2.jar:?]
    at com.microsoft.azure.documentdb.internal.query.DefaultQueryExecutionContext.fillBuffer(DefaultQueryExecutionContext.java:98) ~[azure-documentdb-1.16.2.jar:?]
    at com.microsoft.azure.documentdb.internal.query.DefaultQueryExecutionContext.next(DefaultQueryExecutionContext.java:81) ~[azure-documentdb-1.16.2.jar:?]