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
db.collection.count(function(err,countData){ //you will get the count of number of documents in mongodb collection in the variable countdata });
In place of collection give your mongodb collection name