问题
I am trying to retrieve results from Azure CosmosDb. Below code returns HasMoreResults equal to true; however when I call ExecuteNextASync; I don't get any result. I have read through a few similar issues but could not yet identify a definitive solution. Thanks for the help!
public async Task<List<Trackers>> GetTrackersDataAsync()
{
try
{
var query = client.CreateDocumentQuery<Trackers>(collectionLink, new FeedOptions { MaxItemCount = -1, EnableCrossPartitionQuery = true })
.OrderByDescending(x => x.LocatedAt)
.AsDocumentQuery();
MFZTrackers = new List<Trackers>();
while (query.HasMoreResults)
{
var result = await query.ExecuteNextAsync<Trackers>();
MFZTrackers.AddRange(result);
}
}
catch (Exception e)
{
Console.Error.WriteLine(@"ERROR {0}", e.Message);
return null;
}
return MFZTrackers;
}
来源:https://stackoverflow.com/questions/51013156/azure-cosmosdb-documentquery-returns-hasmoreresults-as-true-but-executenextasync