How to count documents of a collection in MongoDB

Today, I had to do this at work. turns out it is very easy. I am using Robomongo 1.0-RC1. I just double click on the collection that I want, in this case knives and I just execute the following query:

db.getCollection('knives').count()

The result in my case is:

1911

Hope it helps!

Sources

  • https://docs.mongodb.com/manual/reference/method/db.collection.count/

Leave a Comment

Your email address will not be published. Required fields are marked *