kmongo / org.litote.kmongo / com.mongodb.client.MongoCollection / distinct

distinct

fun <reified TResult : Any> MongoCollection<*>.distinct(fieldName: String, filter: String = KMongoUtil.EMPTY_JSON): DistinctIterable<TResult> (source)

Gets the distinct values of the specified field name.

Parameters

fieldName - the field name

filter - the query filter

Parameters

Return
an iterable of distinct values

fun <reified T : Any, reified TResult> MongoCollection<T>.distinct(field: KProperty1<T, TResult>, filter: Bson = EMPTY_BSON): DistinctIterable<TResult> (source)

Gets the distinct values of the specified field.

Parameters

field - the field

filter - the query filter

Parameters

Return
an iterable of distinct values

fun <reified TResult : Any> MongoCollection<*>.distinct(clientSession: ClientSession, fieldName: String, filter: String = KMongoUtil.EMPTY_JSON): DistinctIterable<TResult> (source)

Gets the distinct values of the specified field name.

Parameters

clientSession - the client session with which to associate this operation

fieldName - the field name

filter - the query filter

Parameters

Return
an iterable of distinct values

fun <reified T : Any, reified TResult> MongoCollection<T>.distinct(clientSession: ClientSession, field: KProperty1<T, TResult>, filter: Bson = EMPTY_BSON): DistinctIterable<TResult> (source)

Gets the distinct values of the specified field.

Parameters

clientSession - the client session with which to associate this operation

field - the field

filter - the query filter

Parameters

Return
an iterable of distinct values