Cosmos Status Code 400 - SubStatus Code 1004

When calling Cosmos DB via Gateway Mode and you get a HTTP 400 status code, the Cosmos DB Gateway is telling you the request contains invalid data or is missing required parameters.   A sub status code 1004 means that the query is not support cross partition.  Cosmos DB can run partitions (as defined by the partition key) on multiple nodes in the region, however some queries can’t be executed on sperate nodes and then combined in the response.  For example queries with Order By, Top, District, Offset, Limit and Group by require the data from this separate nodes to be evaluated together. 

To solve this issue, do the aggregate, ordering and grouping at the client after the data is return.  Or target just a single partition with queries that contain this syntax.



Popular posts from this blog

Simple WP7 Mango App for Background Tasks, Toast, and Tiles: Code Explanation

Yet once more into the breech (of altered programming logic)

How to convert SVG data to a Png Image file Using InkScape