在Meteor.js中,我如何让两个开发项目使用同一个Mongo实例? [英] In Meteor.js, how would I have two development projects use the same Mongo instance?

查看:63
本文介绍了在Meteor.js中,我如何让两个开发项目使用同一个Mongo实例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想让两个单独的应用程序使用同一个Mongo数据库实例,并且由于我同时开发它们,所以我希望能够共享同一个开发数据库实例.

I would like to have two separate applications use the same Mongo DB instance, and since I am developing them at the same time I would like to be able to share the same development DB instance.

我意识到,Meteor的每个实例都必须在其自己的端口上运行.有没有办法强制流星或mrt连接到本地套接字(例如MongoDB的系统版本)?

I realize that each instance of Meteor would have to run on it's own port. Is there a way to force meteor or mrt to connect to a local socket like the system version of MongoDB?

推荐答案

是的,您可以使用MONGO_URL参数启动流星,例如:

Yeah, you can just start meteor with the MONGO_URL parameter like:

$ MONGO_URL="mongodb://localhost:27017/myapp" meteor

$ MONGO_URL="mongodb://localhost:27017/myapp" meteor --port 4000

这假定您在系统上安装了mongodb.请参阅此问题,以了解通过使用环境变量或开始来使此过程更简单的方法脚本.

This assumes you have mongodb installed on your system. See this question for ways to make this process a little easier by using environment variables or a start script.

这篇关于在Meteor.js中,我如何让两个开发项目使用同一个Mongo实例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆