Help join collection with foreign is array element

Hi everyone,

I am just starting with mongo, if you can help me with a query, I have a collection that your foreign field is an array elements, I need to join it with your table to fetch your data

thanks :)))

With the $lookup aggregation pipeline stage you can use the array field to do the match.

The $lookup has the following syntax; you can specify an array field in the foreignField parameter.

$lookup: {
    from: < collection to join with - must be from same database and must not be sharded >,
    localField: < field from the input documents >,
    foreignField: < field from the documents of the 'from' collection >,
    as: < output array field >