如何在流星中建立单独的测试和开发数据库 [英] How to set up separate test and development database in meteor
本文介绍了如何在流星中建立单独的测试和开发数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经为流星应用编写了一些测试.由于它们具有删除所有文档或填充新文档的设置和拆卸方法,因此,我希望在专用于测试的数据库上运行它们.
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.
我注意到数据库存储在.meteor/local/db中.理想情况下,我想从不同的端口访问db_test和db_dev.
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.
这可能吗?
推荐答案
您将必须运行两个mongod
进程,例如
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
这应该起作用.使用排行榜示例项目:
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.
这篇关于如何在流星中建立单独的测试和开发数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文