Meteor custom mongodb during development

前端 未结 2 999
执念已碎
执念已碎 2021-01-31 18:51

How would I use a (live running) MongoDB to develop another meteor app? I tried modifying (.meteor/server/server.js) and specifying MONGO_URL to no ava

相关标签:
2条回答
  • 2021-01-31 19:01

    I found that you should not forget to specify the database to connect to. In my case, I wanted a second Meteor instance to connect to the development MongoDB server from a first instance.

    Meteor uses the HTTP port +2 for a development MongoDB, and database 'meteor', so the correct way to start the second server is:

    MONGO_URL=mongodb://localhost:3002/meteor meteor --port=3800
    
    0 讨论(0)
  • 2021-01-31 19:05

    As mentioned in the Unofficial Meteor FAQ, you can invoke Meteor with the MONGO_URL environment variable set to the desired instance:

    MONGO_URL=mongodb://localhost:27017 meteor
    

    If your MongoDB handles multiple databases, you can indicate which one to use by appending it to the URL:

    MONGO_URL=mongodb://localhost:27017/mydb meteor
    

    You can even prevent Meteor from starting a local Mongo instance in development by running:

    MONGO_URL=none meteor
    
    0 讨论(0)
提交回复
热议问题