如何在 Meteor 应用程序之间共享 MongoDB 集合? [英] How can I share MongoDB collections between Meteor apps?
问题描述
我希望能够为我的项目提供一个管理应用程序和一个客户端应用程序.理想情况下,我希望能够拥有一个共享的 MongoDB 集合.我怎么能做到这一点?
I'd like to be able to have an admin app and a client app for my project. Ideally, I'd like to be able to have a shared MongoDB collection. How would I be able to accomplish this?
我尝试在两个不同的应用程序中创建具有相同名称的集合,但发现 Meteor 会将数据分开.知道我能做什么吗?谢谢.
I tried creating collections with the same name in two different apps, but found that Meteor will keep the data separate. Any idea what I can do? Thanks.
推荐答案
export MONGO_URL=mongodb://localhost:3002/meteor
然后运行meteor app,它会改变meteor 使用的默认数据库.所以共享数据库或集合不会有问题!出于管理原因,除了使用meteor 的内部MongoDB 之外,我会使用自己管理的单个MongoDB 服务器.
Then run meteor app, it will change the default database meteor uses. So share databases or collections won't be a problem! For administrative reason, I would use a individual MongoDB server managed by myself other than using meteor's internal MongoDB.
这篇关于如何在 Meteor 应用程序之间共享 MongoDB 集合?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!