xxxxxxxxxx
{
$lookup:
{
from: <collection to join>,
localField: <field from the input documents>,
foreignField: <field from the documents of the "from" collection>,
as: <output array field>
}
}
xxxxxxxxxx
let videos= await Beg.aggregate([
{
$project: {
_id: 1,
},
},
{
$lookup: {
from: "videos",
localField: "_id",
foreignField: "begId",
as: "videos",
},
},
]);