count docs in collection mongodb code example Example: count collection mongodb db.mycollection.count()