MongoDB count() versus countDocuments()
The db.collection.find method returns a cursor. The cursor.count() method on the cursor counts the number of documents referenced by a cursor. This is same as the db.collection.count(). Both these methods (the cursor.count() and db.collection.count()) are deprecated as of MongoDB v4.0. From the documentation: MongoDB drivers compatible with the 4.0 features deprecate their respective cursor and … Read more