Repository: mongodb/mongo-rust-driver (language: rust)

Issue:
[docs] Need more info on recommendations for `Collection::count_documents` methods
Hi, in the documentation for the methods [`Collection::count_documents`](https://docs.rs/mongodb/2.7.0/mongodb/struct.Collection.html#method.count_documents) and [`Collection::count_documents_with_session`](https://docs.rs/mongodb/2.7.0/mongodb/struct.Collection.html#method.count_documents_with_session), it is recommended to use another method (`Collection::estimated_document_count`). I didn't find any such recommendation nor explanation for this in https://www.mongodb.com/docs/v7.0/reference/method/db.collection.countDocuments/. Furthermore, these methods do not have the same purpose as the recommended one.

If relevant, I would be happy to make a pull request.


Discussion / hints:
Hey @cailloumajor, you're right that this recommendation does not align with the MongoDB-wide guidance on how to use these methods. We would recommended using `estimatedDocumentCount` when an outdated/incorrect count is tolerated (see [here](https://www.mongodb.com/docs/manual/reference/method/db.collection.estimatedDocumentCount/#behavior) for more info) and `count` when total accuracy is needed. Feel free to make a pull request updating this info if you'd like to!
There has not been any recent activity on this ticket, so we are marking it as stale. If we do not hear anything further from you, this issue will be automatically closed in one week.

Fix patch:
diff --git a/src/coll.rs b/src/coll.rs
index f85e9e3f0..953906bca 100644
--- a/src/coll.rs
+++ b/src/coll.rs
@@ -402,8 +402,7 @@ impl<T> Collection<T> {
 
     /// Gets the number of documents matching `filter`.
     ///
-    /// Note that using [`Collection::estimated_document_count`](#method.estimated_document_count)
-    /// is recommended instead of this method is most cases.
+    /// Note that this method returns an accurate count.
     pub async fn count_documents(
         &self,
         filter: impl Into<Option<Document>>,
@@ -414,8 +413,7 @@ impl<T> Collection<T> {
 
     /// Gets the number of documents matching `filter` using the provided `ClientSession`.
     ///
-    /// Note that using [`Collection::estimated_document_count`](#method.estimated_document_count)
-    /// is recommended instead of this method is most cases.
+    /// Note that this method returns an accurate count.
     pub async fn count_documents_with_session(
         &self,
         filter: impl Into<Option<Document>>,


Test patch: