How to set up separate test and development database in meteor

与世无争的帅哥 提交于 2019-12-09 11:03:07

问题


I've written a few tests for my meteor app. As they have setup and teardown methods that remove all documents or populate with new ones, I'd like to run them on a database dedicated to testing.

I notice the db is stored in .meteor/local/db . Ideally I'd like to have db_test and db_dev accessed form different ports.

Is this possible?


回答1:


You'll have to run two mongod processes e.g.

# Dev
mongod --port 27017 --dbpath .meteor/local/db_dev

# Testing
mongod --port 28017 --dbpath .meteor/local/db_test


[Edit] This should work. Using the leaderboard example project:
MONGO_URL="mongodb://127.0.0.1:27017/appname_dev" meteor run --port 3000
MONGO_URL="mongodb://127.0.0.1:28017/appname_test" meteor run --port 4000

That will use separate databases.



来源:https://stackoverflow.com/questions/14166436/how-to-set-up-separate-test-and-development-database-in-meteor

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!