Connect multiple meteor apps to the same local mongodb

I have one two apps that share a mongodb instance. But I can’t seem to set it up locally. I want to do something like this:

app1:

MONGO_URL=mongodb://localhost:27017/ \
ROOT_URL="http://localhost:3000" \
meteor

app2:

MONGO_URL=mongodb://localhost:27017/ \
ROOT_URL="http://localhost:3001" \
meteor

This doesnt seem to work though. I also tried:

MONGO_URL=mongodb://localhost:27017/ \
PORT=3001 \
ROOT_URL="http://localhost" \
meteor

OK. So it appears using MONGO_URL will prevent meteor from spinning up mongo. And it always runs mongo on the current port + 1.

app1:

meteor --port 3000

app2:

MONGO_URL=mongodb://localhost:3001/meteor \
meteor --port 3002

And that works :slight_smile:

2 Likes