kmongo / org.litote.kmongo / lookup

lookup

fun <FROM : Any> lookup(from: MongoCollection<FROM>, localField: KProperty1<out Any, Any?>, foreignField: KProperty1<FROM, Any?>, newAs: KProperty1<out Any, Any?>): Bson (source)

Creates a $lookup pipeline stage for the specified filter (Typesafe version)

Parameters

from - the collection in the same database to perform the join with.

localField - specifies the field from the local collection to match values against.

foreignField - specifies the field in the from collection to match values against.

newAs - the name of the new array field to add to the input documents.

Return
the $lookup pipeline stage

Mongodb
.driver.manual reference/operator/aggregation/lookup/ $lookup

fun lookup(from: String, localField: String, foreignField: String, newAs: String): Bson (source)

Creates a $lookup pipeline stage for the specified filter

Parameters

from - the name of the collection in the same database to perform the join with.

localField - specifies the field from the local collection to match values against.

foreignField - specifies the field in the from collection to match values against.

newAs - the name of the new array field to add to the input documents.

Return
the $lookup pipeline stage

Mongodb
.driver.manual reference/operator/aggregation/lookup/ $lookup

fun lookup(from: String, let: List<Variable<out Any>>? = null, resultProperty: KProperty<Any?>, vararg pipeline: Bson): Bson (source)

Creates a $lookup pipeline stage, joining the current collection with the one specified in from using the given pipeline

Parameters

from - the name of the collection in the same database to perform the join with.

let - the variables to use in the pipeline field stages.

resultProperty - the name of the new array field to add to the input documents.

pipeline - the pipeline to run on the joined collection.

Parameters

Return
the $lookup pipeline stage

Mongodb
.driver.manual reference/operator/aggregation/lookup/ $lookup

Mongodb
.server.release 3.6

Since
3.7