-
Notifications
You must be signed in to change notification settings - Fork 56
Bad request when attempting to query collection #168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Adding a WHERE clause seems to fix it. This seems to mean that |
What I don't understand is that I cannot use ORDER BY without a WHERE.... Maybe there is something I am missing |
Looks like the
https://docs.microsoft.com/en-us/rest/api/cosmos-db/query-documents Considering cosmos enforces partition keys on all new containers now afik, the default for this should probably be changed to true. |
I still cannot use ORDER BY without a WHERE though.... Hmm |
I was trying to investigate the response using Looking at the body on the raw response gives the following error: {
"code": "BadRequest",
"message": "The provided cross partition query can not be directly served by the gateway. This is a first chance (internal) exception that all newer clients will know how to handle gracefully. This exception is traced, but unless you see it bubble up as an exception (which only happens on older SDK clients), then you can safely ignore this message.\r\nActivityId: 670a6198-e094-4905-b6b9-da1fd56b73e4, Microsoft.Azure.Documents.Common/2.14.0",
"additionalErrorInfo": "{\"partitionedQueryExecutionInfoVersion\":2,\"queryInfo\":{\"distinctType\":\"None\",\"top\":null,\"offset\":null,\"limit\":null,\"orderBy\":[\"Descending\"],\"orderByExpressions\":[\"c.sellerId\"],\"groupByExpressions\":[],\"groupByAliases\":[],\"aggregates\":[],\"groupByAliasToAggregateType\":{},\"rewrittenQuery\":\"SELECT c._rid, [{\\\"item\\\": c.sellerId}] AS orderByItems, {\\\"sellerId\\\": c.sellerId} AS payload\\nFROM ROOT AS c\\nWHERE ({documentdb-formattableorderbyquery-filter})\\nORDER BY c.sellerId DESC\",\"hasSelectValue\":false,\"dCountInfo\":null},\"queryRanges\":[{\"min\":\"\",\"max\":\"FF\",\"isMinInclusive\":true,\"isMaxInclusive\":false}]}"
} |
Looks like its actually been deprecated and should be updated... |
According to this the gateway cannot support certain queries..... Does that mean that it's just not possible to execute these queries or is there some sort of work around?
|
Looks like there is a way to handle this that the SDK's use that is covered here: I should be able to get this working in this library... Will fork and see what I can do. |
Working with changes in pull request |
Closing this as duplicate of #123. Thanks for the PRs! Left some comments- need to figure out what subset of cross-partition queries it makes sense to support. |
Hi, I don't know what I'm doing wrong but when attempting to use this query:
I am getting this result:
Note: I replaced sensitive info with REDACTED.
Is this a bug with this sdk or is there something I am doing wrong?
The text was updated successfully, but these errors were encountered: