I want to retrieve one item from Cosmos DB and there must be a better way than what I am doing here.
I've tried other commands, but this seems to actually work.
public async Task<ToDoItem> GetAsync(string id)
{
FeedIterator<ToDoItem> results = container.GetItemQueryIterator<ToDoItem>("select top 1 * from Items i where i.id = '" + id + "'");
FeedResponse<ToDoItem> item = await results.ReadNextAsync();
return item.Resource.FirstOrDefault();
}
I expect to be able to do this with one line that executes on the server and doesn't force me to look at a set of items.