I am currently investigating the best way of updating data across multiple collections in C#.
An example use case I have is that I have 2 collections:
- Collection 1 = Consoles
- Collection 2 = Games
The console collection looks like this: _id, Name, Year of Release, ThumbnailUrl, Enabled
The game collection looks something like this: _id, Name, Year Of Release, ThumbnailUrl, Console
Where the console sub-document looks like this: _id, Name, ThumbnailUrl
In SQL server world I would set this up a link and create an inner join to collect the data. However, in MongoDb I am taught to duplicate data.
How can I update the name of a console in the console collection and update all sub-documents to update the name of the console for the consoles with the identifier I've just modified in the console collection?
I am looking for an understanding of how I would go about this, and going forward I'm looking at adding more collections, all with similar sub-document references but need to be able to update everything as straightforward as possible.