How to join multiple collections in mongodb? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to join multiple collections in mongodb?

I'm new in mongo db, i want to join 6 collections in mongodb by node.js, which none of them have the same field,I would be pleased if anyone give me a link which explains it in a simple way, i've searched a lot but i couldn't get the best solution.

22nd Jun 2021, 4:20 PM
Nasim NP
1 Answer
+ 1
"none of them have the same field" How do you want to join them if they have nothing in common? If one collection has 8 elements and the other one has 7, their combination would have 56 different elements (cartesian product). With 6 collections this number can grow really quickly... Is this what you want? https://www.w3schools.com/nodejs/nodejs_mongodb_join.asp
24th Jun 2021, 7:27 PM
Tibor Santa
Tibor Santa - avatar