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

查看:11
本文介绍了在 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 的每个实例都必须在自己的端口上运行.有没有办法像系统版MongoDB那样强制meteor或者mrt连接到本地socket?

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 参数启动meteor,例如:

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天全站免登陆