|
The Distinct method of IMongoCollection assumes that the member is a scalar value:
IAsyncCursor<TField> Distinct<TField>(FieldDefinition<TDocument, TField> field, FilterDefinition<TDocument> filter, DistinctOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
|
Because of the way Distinct works with array members an additional overload is needed to correctly handle array members:
IAsyncCursor<TItem> DistinctMany<TItem>(FieldDefinition<TDocument, IEnumerable<TField>> field, FilterDefinition<TDocument> filter, DistinctOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
|
|
Note that the return values are of type TItem, not TField.
|