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