Tag Archives: meteor

Meteor on Windows with standalone MongoDB

In this post I describe how to run Meteor on Windows with a standalone DB (rather than the one that runs by default from Meteor). This allows us to run an instance of MongoDB that can communicate with other computers.

  • Install Meteor for Windows
  • Install MongoDB Community edition for Windows
  • Open a command prompt, type ‘md /data/db’ (this directory is needed to store the database files)
  • Navigate to the directory where mongod.exe was installed (for me, this was ‘C:\Program Files\MongoDB\Server\3.2\bin’)
  • Type ‘mongod.exe’ to start the MongoDB server; the first time, this will prompt Windows Firewall to ask if you want to allow an exception (choose yes, keeping in mind that you are allowing any incoming connections to write to the db; you can limit this to private networks, and you can turn off the mongod when not using it)
  • Open another command prompt and type ‘setx MONGO_URL mongodb://localhost:27017/meteor’ – You should only need to do this once; it sets the MONGO_URL environment variable in the registry; Meteor will now use the new instance of MongoDB instead of starting its own, and will assume that everything is in a database called ‘meteor’.
  • Navigate to a meteor project, and start meteor – Note that it should not output a line relating to “Started MongoDB”, since mongodb is already running.
  • Meteor should now be using the database ‘meteor’ running on the mongodb that you started
  • You should now be able to connect to the MongoDB from another computer on the local network. For example, in python, the following will work (replace XXX with the correct IP):
  • #! /usr/bin/python
    from pymongo import MongoClient
    #Connect to the database (default for meteor)
    client = MongoClient('192.168.1.XXX',27017)
    dbs = client.database_names()
  • When you are done,  quit meteor, then quit the terminal running mongod.