'Mongodb lookup with localfield $in foreignfield

I have tags collection and products collections. Tags have tag names while products have multiple tags save in array. I want to apply join on tags and get all the records from dishes collection where tag name from tags collection exists in tags array of dishes. i want something like this

const tag = await Tag.
  aggregate([
    { $lookup:
       {
         from: 'products',
         localField: 'name',
         foreignField: { tag :{ $in :'name'}},
         as: 'tagsdetails'
       }
     }
    ]);


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source