singnet / das-atom-db

Persistence layer
MIT License
2 stars 0 forks source link

Fix `count_atoms()` to use deterministic counting #124

Closed andre-senna closed 6 months ago

marcocapozzoli commented 6 months ago

Today we are using the .estimated_document_count() method from the pymongo library. According to the documentation, this method is faster than .count_documents() but its result is an estimate of the number of documents in this collection. Therefore, it introduces uncertainty into the result. On the other hand, .count_documents() is slower but accurate. In addition to accepting a filter as a parameter.

https://pymongo.readthedocs.io/en/stable/api/pymongo/collection.html#pymongo.collection.Collection.count_documents:~:text=in%20version%203.7.-,estimated_document_count,-(comment%3A