References
Reference system between schemas, through a find you can merge data from other schemas.
Searching with Schema references
{ "$ref" : <value>, "$id" : <value> }Example
User.find({
_id: 1,
creator: { $ref: "Creators", $id: 1 },
}); // { _id: 1, username: 'Customer', bag: { weapons: [ 'bow', 'katana' ] }, creator: { _id: 2, name: 'Lennart' } }$data = {
a: {
b: {
c: 22,
d: [1, 2, 3],
},
}
}
"$data.a.b.d.1" // 2
"$data.a.b.c" // 22Using the property $data
Last updated