Is it possible, using the DocumentDB .NET SDK, to make run an asynchronous query against the DB that returns all matching documents?
The answer answer to this StackOverflow question: Querying Azure DocumentDB with ExecuteNextAsync returns fewer than MaxItemCount indicates that:
There are limits for how long a query will execute on DocumentDB.
...
If these limits are hit, then a partial set of results may be returned.
I know that it's possible to overcome the above mentioned limit by iterating over paged results like so: (source)
List<Family> families = new List<Family>();
FeedOptions options = new FeedOptions { MaxItemCount = 1 };
var query = client.CreateDocumentQuery<Family>(collectionLink, options).AsDocumentQuery();
while (query.HasMoreResults)
{
foreach (Family family in await query.ExecuteNextAsync())
{
families.Add(family);
}
}
My question is - Is this loop necessary? Might there be a more elegant way to tell the SDK to return all results available (without paging)?
CreateStoredProcedureQueryy
. Likeclient.CreateStoredProcedureQuery(collectionLink,"Select * from myColleciton");
. – vikscool