mongodb aggregation get unique documents by values from field code example Example: mongodb distinct Db.collection.distinct('searchField')