how to check unique values in mongodb code example Example: mongodb count distinct db.collection.distinct('field').length