MongoDB $lookup example | join multiple collection using MongoDB | sub query to join collection.
Performs a left outer join to a collection in the same database to filter in documents from the “joined” collection for processing. The
$lookup stage adds a new array field to each input document. The new array field contains the matching documents from the “joined” collection. The
$lookup stage passes these reshaped documents to the next stage.
The aggregation pipeline stage $lookup makes it possible to join data from an input collection (the collection you’re running the query on) and a lookup collection (the collection you want data from), as long as both collections are on the same database.
https://www.mongodb.com/docs/manual/reference/operator/aggregation/lookup/
#monngodb, #lookup , #joincollection
Comments are closed.