db = Databases(client)db.count_documents(database_id, collection_id, queries=queries)
TL;DR
You can use the `count_documents` method to get the count of a collection instead of retrieving all of the data. This method works for collections with less than 5000 documents. Just query all documents and limit the response to 1 document. In the response, you will find a property called `response.total` which provides the total number of documents in that collection. Here's an example code snippet:
```
db = Databases(client)
db.count_documents(database_id, collection_id, queries=queries)
```
frankenstein
16 Nov, 2023, 20:38
just query all documents then limit to 1 document. in the response you will get a response.total thats the total number of documents in that collection