Saturday, April 19, 2014

MongoDB Collection Counting

This is done via the method "count()"

db.userAccount.count()

This can be extended to perform conditional counting:

e.g. number of users in New York city

db.userAccount.count({"city":"New York"})

More examples and references: http://docs.mongodb.org/manual/reference/method/db.collection.count/

No comments:

Post a Comment