Richard Hauer
Richard Hauer

Reputation: 1346

Querying Azure DocumentDB with ExecuteNextAsync returns fewer than MaxItemCount

I am querying an Azure DocumentDB collection using the FeedOption MaxItemCount to set the "page" size, and IDocumentQuery<T>::ExecuteNextAsync<T>(). When this is called with small values, say <100, against a set of 10,000 documents I consistently get back the number of objects I set as the limit.

However, when I execute with larger MaxItemCount values, say 500, I get back all manner of results, but never more than the MaxItemCount.

Now, I appreciate that MaxItemCount is a "max item count" but it was my understanding from the literature that the bounding factor was the number of objects in the collection. Something else is clearly limiting my results, and we can see the same behaviour in the Document Explorer and Query Explorer tools in the Azure Portal also.

The collection is set to "S3" which should support 2500RU and the Query Explorer shows a "cost" of less than 100RU.

Does anyone know what's going on here? What is constraining my result set?

Upvotes: 0

Views: 1583

Answers (1)

Andrew Liu
Andrew Liu

Reputation: 8119

There are limits for how long a query will execute on DocumentDB. These limits include the query's resource consumption (you can ballpark this w/ the amount of provisioned RU/sec * 5 sec + an undisclosed buffer), response size (1mb), and timeout (5 sec). If these limits are hit, then a partial set of results may be returned.

Upvotes: 3

Related Questions