In Meteor.js, how would I have two development projects, use the same instance of Mongo?

I would like two separate applications to use the same instance of Mongo DB, and since I am developing them at the same time, I would like to be able to use the same instance of the development database.

I understand that each instance of Meteor will have to launch its own port. Is there a way to force a meteorite or mrt to connect to a local socket, like the system version of MongoDB?

+6
mongodb meteor
source share
2 answers

Yes, you can just start the meteor with the MONGO_URL parameter, for example:

 $ MONGO_URL="mongodb://localhost:27017/myapp" meteor 

or

 $ MONGO_URL="mongodb://localhost:27017/myapp" meteor --port 4000 

This assumes mongodb is installed on your system. See this question to facilitate this process with environment variables or the start of a script.

+10
source share

David answers in the right direction, but has thrown me a little. Instead, we do this to launch the first application as usual:

 $ meteor 

Then, to launch the second application and connect to the database of the first, we do:

 $ MONGO_URL="mongodb://localhost:3001/meteor" meteor --port 3002 

The key point here is that the meteorite launches its own instance of mango on port 3001 , and we can connect to it directly from the second instance of the meteor. David's answer uses your mongo system for both applications.

+5
source share

All Articles