'How to manage collection in MongoDb as a vector (or similar) to reuse as in SQL?

FROM user, (SELECT artist FROM art) as artName
WHERE name LIKE CONCAT("%", artName,"%") 
GROUP BY name
ORDER BY name;

I would like to replicate this query in MongoDB but I don't understand how I can replicate this part: (SELECT artist FROM art) as artName. And also to use a variabile as string like in SQL.



Sources

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

Source: Stack Overflow

Solution Source