Documentation Index
Fetch the complete documentation index at: https://mongodb-preview.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Example
Create two sample collections,inventory and orders:
Create a Joined View
This command usesdb.createView() to create a new view named sales based on the orders collection:
-
The
$lookupstage uses theprodIdfield in theorderscollection to “join” documents in theinventorycollection that have matchingprodIdfields. -
The matching documents are added as an array in the
inventoryDocsfield. -
The
$projectstage selects a subset of the available fields. -
The
$unwindstage converts thepricefield from an array to a scalar value.
sales view are: