lookup

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

Creates a $lookup pipeline stage for the specified filter

Return

the $lookup pipeline stage

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.


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

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

Return

the $lookup pipeline stage

Since

3.7

Parameters

the Variable value expression type
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.