mongodb query to print distinct count with filter code example Example: mongodb count distinct db.collection.distinct('field').length