Skip to content

Instantly share code, notes, and snippets.

@dontpaniclabsgists
Last active August 28, 2017 13:57
Show Gist options
  • Save dontpaniclabsgists/3b3109f768582f9cbfdbe7879e2629b9 to your computer and use it in GitHub Desktop.
Save dontpaniclabsgists/3b3109f768582f9cbfdbe7879e2629b9 to your computer and use it in GitHub Desktop.
Cosmos2_6
public async Task<int> Count()
{
using (var client = new DocumentClient(new Uri(_endpoint), _key))
{
var link = UriFactory.CreateDocumentCollectionUri(_databaseId, CollectionId);
var count = client.CreateDocumentQuery<Note>(
link,
new FeedOptions()
{
EnableCrossPartitionQuery = true
})
.Count();
return count;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment