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

projection

inline fun <T, reified F> MongoCollection<T>.projection(property: KProperty<F>, query: Bson = EMPTY_BSON, options: (FindIterable<SingleProjection<F>>) -> FindIterable<SingleProjection<F>> = { it }): MongoIterable<F> (source)

Returns the specified field for all matching documents.

Parameters

property - the property to return

query - the optional find query

options - the optional FindIterable modifiers

Return
a property value iterable

inline fun <T, reified F1, reified F2> MongoCollection<T>.projection(property1: KProperty<F1>, property2: KProperty<F2>, query: Bson = EMPTY_BSON, options: (FindIterable<PairProjection<F1, F2>>) -> FindIterable<PairProjection<F1, F2>> = { it }): MongoIterable<Pair<F1?, F2?>> (source)

Returns the specified two fields for all matching documents.

Parameters

property1 - the first property to return

property2 - the second property to return

query - the optional find query

options - the optional FindIterable modifiers

Return
a pair of property values iterable

inline fun <T, reified F1, reified F2, reified F3> MongoCollection<T>.projection(property1: KProperty<F1>, property2: KProperty<F2>, property3: KProperty<F3>, query: Bson = EMPTY_BSON, options: (FindIterable<TripleProjection<F1, F2, F3>>) -> FindIterable<TripleProjection<F1, F2, F3>> = { it }): MongoIterable<Triple<F1?, F2?, F3?>> (source)

Returns the specified three fields for all matching documents.

Parameters

property1 - the first property to return

property2 - the second property to return

property3 - the third property to return

query - the optional find query

options - the optional FindIterable modifiers

Return
a triple of property values iterable

inline fun <T, reified F> MongoCollection<T>.projection(clientSession: ClientSession, property: KProperty<F>, query: Bson = EMPTY_BSON, options: (FindIterable<SingleProjection<F>>) -> FindIterable<SingleProjection<F>> = { it }): MongoIterable<F> (source)

Returns the specified field for all matching documents.

Parameters

clientSession - the client session with which to associate this operation

property - the property to return

query - the optional find query

options - the optional FindIterable modifiers

Return
a property value iterable

inline fun <T, reified F1, reified F2> MongoCollection<T>.projection(clientSession: ClientSession, property1: KProperty<F1>, property2: KProperty<F2>, query: Bson = EMPTY_BSON, options: (FindIterable<PairProjection<F1, F2>>) -> FindIterable<PairProjection<F1, F2>> = { it }): MongoIterable<Pair<F1?, F2?>> (source)

Returns the specified two fields for all matching documents.

Parameters

clientSession - the client session with which to associate this operation

property1 - the first property to return

property2 - the second property to return

query - the optional find query

options - the optional FindIterable modifiers

Return
a pair of property values iterable

inline fun <T, reified F1, reified F2, reified F3> MongoCollection<T>.projection(clientSession: ClientSession, property1: KProperty<F1>, property2: KProperty<F2>, property3: KProperty<F3>, query: Bson = EMPTY_BSON, options: (FindIterable<TripleProjection<F1, F2, F3>>) -> FindIterable<TripleProjection<F1, F2, F3>> = { it }): MongoIterable<Triple<F1?, F2?, F3?>> (source)

Returns the specified three fields for all matching documents.

Parameters

clientSession - the client session with which to associate this operation

property1 - the first property to return

property2 - the second property to return

property3 - the third property to return

query - the optional find query

options - the optional FindIterable modifiers

Return
a triple of property values iterable