Get record count in Azure DocumentDb Get record count in Azure DocumentDb azure azure

Get record count in Azure DocumentDb


This is now possible in the year 2017 of our lord.

SELECT VALUE COUNT(1) FROM c

[ 1234 ]


Actually works at this point:

SELECT COUNT(c.id) FROM c


Until the implementation of the "count" keyword, you should do your query in a store procedure on the server. Take care to not get all columns/properties in your query if you want only a count.

Select only the id like;

  dc.CreateDocumentQuery(update.SelfLink, "SELECT c.id FROM c")