Reputation: 4385
I have a database with about 600-700 thousand documents. When I am in the Document Explorer and I execute "SELECT value count(1) FROM c", it returns values ranging from 64,000 to 72,000, seemingly at random. When I execute this using the Python SDK, it returns the actual count I mentioned above. Why is this?
Upvotes: 3
Views: 3174
Reputation: 1577
The count query is limited by the number for RUs allocated to your collection. The response that you would have received will have a continuation token. You have to keep looking for next set of results and keep on adding it, which will give you the final count. For example, I tried a count query on my Cosmos DB, and these were the results
First execution
[ { "$1": 184554 } ]
Next set of continuation. (By clicking Next button from Azure portal Data Explorer)
[ { "$1": 181909 } ]
Next set of continuation. (By clicking Next button from Azure portal Data Explorer)
[ { "$1": 25589 } ]
So, finally the count is 184554 + 181909 + 25589 = 3,92,052
Upvotes: 5