Subset Pattern duplicated data

Hi. The subset patter suggest to split the information as one subset in the one part of the relation and take the other part on another collection. My question is if the subset remaining in the one part of the relation it is duplicated on the separate collection or only resides in one side.

This is an excellent question.

It depends on the queries your application is doing.

When using the pattern to split a document and have a One-to-One relationship between those documents, the default would be not to duplicate information between the two documents kept in the two collections. However, if there are queries, like analytic ones, that you want to do on the full information, the second collection could contain the full documents.

When using the pattern to split a One-to-Many relationship, for example keeping the top ten reviews with the document and moving all other reviews to another collection, the default would be for the second collection to contain all the reviews, including the top ten reviews that are kept with the main document. This makes it easier to collect all the reviews that go together.

MongoDB University.


Very clear, thanks @danielcoupal