getting count of unique values in mogodb code example Example: mongodb count distinct db.collection.distinct('field').length