Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to - multiple Meteor apps on single MongoDB - same collections?

Tags:

mongodb

meteor

This kind of question has been asked before: How can I share MongoDB collections between Meteor apps?

However, the answer is not clear.

I need to have a Meteor public app and the Administration app separate (for many reasons, but mainly security and code management).

Using the accepted answer: export MONGO_URL=mongodb://localhost:3002/meteor seems reasonable, but below another user 'matthias' points out "When connecting from another app, events that trigger changes in the model would not be transported across those applications. The mongoDB instance itself of course isn't aware of that."

How does one trigger the 'other' meteor app to reevaluate the events/triggers from the MongoDB? Meaning simply if I make a change in the administration module, how can I make the public site reflect those changes? Assuming that is what was meant. Also is there any other functionality that will be lost by this method?

Thanks

like image 448
mfr Avatar asked Nov 28 '14 12:11

mfr


1 Answers

The answer is that you don't have to do anything. As long as the apps use the same database (as identified by the MONGO_URL), they will respond reactively to changes in the data.

In fact separating your app into a front-end and a back-end is a good strategy, as outlined in this video, Why you should split your meteor app.

You can even use the mongo shell to update/insert/delete documents in the database, and the publications will pick them up.

like image 53
Dan Dascalescu Avatar answered Nov 09 '22 05:11

Dan Dascalescu