from

Specifies the foreign collection to join with.

To learn more about the $lookup stage, see HasLookup.lookup.

Example

class Department(
val _id: ObjectId,
val name: String,
)

class User(
val _id: ObjectId,
val name: String,
val department: ObjectId,
val departments: List<Department>,
)

users.aggregate()
.lookup {
into(User::departments)
from(departments.aggregate())
on(User::department, Department::_id)
}

External resources