Let's say there is a running MongoDB server for a GUI client (by wxPython) for a while.
How could I connect my new Meteor project to my already existing MongoDB?
Let's say there is a running MongoDB server for a GUI client (by wxPython) for a while.
How could I connect my new Meteor project to my already existing MongoDB?
You have to keep your app running in one terminal window then open another and type "meteor mongo" and it should work!
In the comments to danny's answer Tom Wijsman recommends patching packages/mongo-livedata/mongo_driver.js, line 21. A better place is in app/meteor/run.js, line 460. This way the environment variable is still picked up if present, such as when running Meteor on Heroku. Just change the default hardcoded mongodb://127.0.0.1 to the location of your MongoDB server.
Just copy the data to the Meteor MongoDB database - no reason to try to hook Meteor up to the existing database and risk overwriting things.
Use
mongoexport
to dump your collections individually, thenmongoimport
to import the files into the database namedmeteor
in the Meteor MongoDB instance. The Meteor MongoDB instance runs on port 3002 with bind_address 127.0.0.1, and the data files are in the Meteor project subdirectory.meteor/local/db
.See the documentation if you're not familiar with import/export in MongoDB.
All I did was add the IP of my Digital ocean droplet server, instead of localhost, and it worked:
EDIT: use MUP to deploy your meteor projects: https://github.com/zodern/meteor-up
Mup uses Docker, and will "link" your 2 containers, thus hosting both the app and mongo on the same VM (server). Your mongoDB shouldn't be accessible from the public IP for security reasons.
We use
npm
:Create a
package.json
file withnpm init
, if you don't have one already.Enter and modify the following line in that file (replacing all the
<...>
's):npm run meteor
Use the environment variable MONGO_URL. Something like:
Replace
your_db
withmeteor
or whatever db you want to use.