Database Development MongoDB

Some questions about MongoDB joins across databases

I have a bunch of services, each with it’s own MongoDB database, All of them are essentially independent since they all have their own database. However, I’m now building another service which use some of the data from this services. In the mongo document I set the ID for the documents in the other database, so I can get the data from that other database. This is a visualization of what I have now:

This way when something changes in a document from Service A, if I get the document from service C I have the same updated values. My question is: is it fine to have such relations or should I bring all collections from the Databases into one Database? Or should I bring the document schema from Service A and B in the document schema for Service C, removing the ID reference?

Leave a Reply

Your email address will not be published. Required fields are marked *