Table of Contents

Method Distinct

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.Legacy.dll

Distinct<TValue>(DistinctArgs)

Returns the distinct values for a given field.

public IEnumerable<TValue> Distinct<TValue>(DistinctArgs args)

Parameters

args DistinctArgs

The args.

Returns

IEnumerable<TValue>

The distint values of the field.

Type Parameters

TValue

The type of the value.

Distinct(string)

Returns the distinct values for a given field.

public virtual IEnumerable<BsonValue> Distinct(string key)

Parameters

key string

The key of the field.

Returns

IEnumerable<BsonValue>

The distint values of the field.

Distinct(string, IMongoQuery)

Returns the distinct values for a given field for documents that match a query.

public virtual IEnumerable<BsonValue> Distinct(string key, IMongoQuery query)

Parameters

key string

The key of the field.

query IMongoQuery

The query (usually a QueryDocument or constructed using the Query builder).

Returns

IEnumerable<BsonValue>

The distint values of the field.

Distinct<TValue>(string)

Returns the distinct values for a given field.

public virtual IEnumerable<TValue> Distinct<TValue>(string key)

Parameters

key string

The key of the field.

Returns

IEnumerable<TValue>

The distint values of the field.

Type Parameters

TValue

The type of the value.

Distinct<TValue>(string, IMongoQuery)

Returns the distinct values for a given field for documents that match a query.

public virtual IEnumerable<TValue> Distinct<TValue>(string key, IMongoQuery query)

Parameters

key string

The key of the field.

query IMongoQuery

The query (usually a QueryDocument or constructed using the Query builder).

Returns

IEnumerable<TValue>

The distint values of the field.

Type Parameters

TValue

The type of the value.