Will the parent and children constructs work in Mongo DB where the children are objects reference to documents in another collection?
Hi Tim,
The suitability of document model relies heavily on your use case, querying pattern and data workload.
For example, if one of your frequently used queries need to find the parent first, then query for a specific children; storing the children in a separate collection will be more costly for the application compared to embedding the children as sub-documents. However, if your application queries the children information often, but rarely querying the parent (i.e. logical categories ) then it will work for that use case.
MongoDB has a flexible schema, and you should leverage this for the benefit of the application. The key challenge in data modeling is balancing the needs of the application, the performance characteristics of the database engine, and the data retrieval patterns.
Depending on your use case, you may find $lookup aggregation useful to perform parent/children look-up.
Regards,
Wan