'Lookup between two collections with different formats using node js and mongodb

I have two collections one collection have a string and the other collection in as an array, How can I join these two collections to get the data,

I know the join function in MongoDB but when I'm joining string with the array it does not give any data.

Eg: subject Collection: have the subject name, pass marks, proof name student collection: have student name, section name,[subject names], marks[here the subject is an array has each student can select multiple subjects ]

I want to look up from the subject in student collection and map to subject in the subject collection. To check if a student has passed or failed.

Thanks



Sources

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

Source: Stack Overflow

Solution Source