Created
November 2, 2019 08:37
-
-
Save AmitDJagtap/9fdbc12409bbfcc2ca55e7eb6b68c241 to your computer and use it in GitHub Desktop.
Example 2. Modelling One-to-Many: Reference parent document from child documents
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Primary Collection | |
[ | |
{ | |
id: ObjectID('AAAA'), | |
partno: '123-aff-456', | |
parentCatalogNo: 1234, | |
name: '#4 grommet', | |
price: 3.99 | |
}, | |
{ | |
id: ObjectID('AAAA'), | |
partno: '909-was-356', | |
parentCatalogNo: 1234, | |
name: '#12 washer', | |
price: 0.10 | |
} | |
] | |
// Referenced Document | |
{ | |
name: 'left-handed smoke shifter', | |
manufacturer : 'Acme Corp', | |
catalog_number: 1234 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment