When we were looking to retrieve sub-documents in our database, we to make another request to catch the sub-documents. We also had to create multiple request to update the parent whe
Until today, when we were looking to retrieve sub-documents in our database, we had to make several requests to it.
Thanks to the poulate () function provided by mongoose, more powerful than the native lookup () of mongoDB, we won't have to do any more:
requests to update sub-documents to parents =>
requests to retrieve sub-documents.
Step By Step
Rework the database nested Object
Rework the document creation and add the population to it
Objective
When we were looking to retrieve sub-documents in our database, we to make another request to catch the sub-documents. We also had to create multiple request to update the parent whe
Until today, when we were looking to retrieve sub-documents in our database, we had to make several requests to it. Thanks to the poulate () function provided by mongoose, more powerful than the native lookup () of mongoDB, we won't have to do any more: requests to update sub-documents to parents => requests to retrieve sub-documents.
Step By Step