MongoCollection.distinct

auto distinct(R = Bson, Q)(string fieldName, Q query, DistinctOptions options = DistinctOptions.init)

Returns an input range of all unique values for a certain field for records matching the given query.

Parameters

fieldNameName of the field for which to collect unique values
queryThe query used to select records
optionsOptions to apply

Returns

An input range with items of type R (Bson by default) is

returned.