How to calculate total number of documents in MongoDB?
How do I calculate the total number of documents in a MongoDB collection? I want to know the most efficient way to get the count, especially for large collections. Should I use count() or countDocuments()?