mongodb: automatically sync embedded documents

Viewed 12

I'm new to mongo so pls bear with me here

From what I understand, one of the biggest advantages of mongo is that it gives us the option to embed related documents, leading to fast and simple reads at the cost of write speed.

This makes total sense, but the question then becomes how can I easily keep multiple embedded documents in sync if they're used in more than 1 collection.

So let's say we had posts that embedded authors, and also groups that embedded authors. And say authors did not change much, so we decided to embed the authors in both posts and groups. Now when an author changes their name for example, you'd have to go update all their posts and all the groups they were in.

Surely there's an abstraction that could handle this for us, so that we could just update a central authors table posts and groups would automatically be updated. Does such an abstraction exist? or am I missing something

0 Answers
Related