I would like to know how to count the number of documents in a collection. I tried the follow
var value = collection.count();
&&
var value = collecti
Through MongoDB Console you can see the number of documents in a collection.
1.Go to mongoDB console and issue command "use databasename". To start the console go up to the bin folder of where MongoDB is installed and click on mongo.exe to start the mongoDB console e.g If the database is myDB then command is "use myDB"
2.Execute this command db.collection.count() collection is like table in RDBMS. e.g if your collection name is myCollection then the command is db.myCollection.count();
this command will print the size of the collection in the console.