Relationships
This commit is contained in:
parent
95909936ef
commit
111438f268
@ -41,6 +41,7 @@ Mongo doesn't require schema or relations but if you need to, you can have them.
|
|||||||
`One-to-many` could be an ID that points to another ID but this is way too "SQL" style. The other approach is to have an embeded document.
|
`One-to-many` could be an ID that points to another ID but this is way too "SQL" style. The other approach is to have an embeded document.
|
||||||
`Many-to-many` is also the same concept but with arrays.
|
`Many-to-many` is also the same concept but with arrays.
|
||||||
The issue is that we might have to update each embedded document in case some information changes. It is better to use references in this case.
|
The issue is that we might have to update each embedded document in case some information changes. It is better to use references in this case.
|
||||||
|
[More about relationships here](https://docs.mongodb.com/manual/applications/data-models-relationships/)
|
||||||
|
|
||||||
# Projections
|
# Projections
|
||||||
Sometimes we don't need the whole document, just a few data, so we can select just the data we need in the second parameter like so:
|
Sometimes we don't need the whole document, just a few data, so we can select just the data we need in the second parameter like so:
|
||||||
|
Loading…
Reference in New Issue
Block a user