+ 10

Mongodb

As you all know that in mongodb we can only perform left outer join using $lookup. My question is that why we can't perform other joins like we do in sql ?

11th Sep 2018, 5:58 PM
Rstar
Rstar - avatar
3 Respostas
+ 1
The thing with NoSQL (MongoDB) is designed for flexible schemas and very fast reading and writing. To each input document the $lookup stage adds a new array field whose elements are the matching documents from the "joined" collection. The $lookup stage passes these reshaped documents to the next stage. The operation will correspond to the following SQL STATEMENT SELECT *, <output array field> FROM collection WHERE <output array field> IN (SELECT * FROM <output array field> WHERE <foreignField>=<collection.localField>); I hope this might be helpful!
20th Sep 2018, 7:13 AM
menzi mthobisi
menzi mthobisi - avatar
0
Hello, please mind your tags - your question does not relate to any of your tags except for mongodb. Your only tag shall be "mongodb"
19th Sep 2018, 6:39 AM
Eldar Bakerman
24th Jan 2021, 3:56 PM
Ranjeet Jha
Ranjeet Jha - avatar