Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use an existing MongoDB in a Meteor project?

Tags:

meteor

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?

like image 309
Drake Guan Avatar asked May 14 '12 17:05

Drake Guan


People also ask

How to use MongoDB in Meteor?

Open a terminal window and run meteor command. It will start running on localhost:3000 if you have not changed to port. Go to Robomongo (or your favorite mongodb client software) and create a new connection, making sure to change the connection address to localhost and the given the port number.

What is Meteor Mongodb?

Meteor provides a complete open source platform for building web and mobile apps in pure JavaScript. The Meteor team chose MongoDB as its datastore for its performance, scalability, and rich features for JSON. Meteor apps run using JavaScript via Node. JS on the server and JavaScript in the phone's browser.

What is Meteor DataBase?

The Visual Meteor DataBase (VMDB) The VMDB contains about 3,000,000 meteors obtained by standardized observing methods which were collected during the last ~25 years.


2 Answers

Use the environment variable MONGO_URL. Something like:

export MONGO_URL=mongodb://localhost:27017/your_db 

Replace your_db with meteor or whatever db you want to use.

like image 169
Dror Avatar answered Sep 23 '22 16:09

Dror


We use npm:

  • Create a package.json file with npm init, if you don't have one already.

  • Enter and modify the following line in that file (replacing all the <...>'s):

"scripts": {"meteor": "MONGO_URL=mongodb://<USER>:<PASSWORD>@<SERVER>:<PORT>/<DB> meteor"} 
  • You can then start meteor with just npm run meteor
like image 44
malix Avatar answered Sep 25 '22 16:09

malix