如何-在单个MongoDB上使用多个Meteor应用程序-相同的集合? [英] How to - multiple Meteor apps on single MongoDB - same collections?

查看:64
本文介绍了如何-在单个MongoDB上使用多个Meteor应用程序-相同的集合?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这种问题曾经被问过: 如何在Meteor应用之间共享MongoDB集合?

This kind of question has been asked before: How can I share MongoDB collections between Meteor apps?

但是,答案尚不清楚.

However, the answer is not clear.

我需要将Meteor公共应用程序与管理"应用程序分开(出于许多原因,但主要是安全性和代码管理).

I need to have a Meteor public app and the Administration app separate (for many reasons, but mainly security and code management).

使用已接受的答案:export MONGO_URL = mongodb://localhost:3002/meteor似乎是合理的,但是在另一个用户"matthias"下方指出当从另一个应用程序连接时,不会传输触发模型更改的事件跨这些应用程序.mongoDB实例本身当然不知道这一点."

Using the accepted answer: export MONGO_URL=mongodb://localhost:3002/meteor seems reasonable, but below another user 'matthias' points out "When connecting from another app, events that trigger changes in the model would not be transported across those applications. The mongoDB instance itself of course isn't aware of that."

一个人如何触发另一个"流星应用重新评估MongoDB的事件/触发?简而言之,就是如果我在管理模块中进行了更改,那么我如何使公共站点反映这些更改?假设是这样.还有其他任何功能会被此方法丢失吗?

How does one trigger the 'other' meteor app to reevaluate the events/triggers from the MongoDB? Meaning simply if I make a change in the administration module, how can I make the public site reflect those changes? Assuming that is what was meant. Also is there any other functionality that will be lost by this method?

谢谢

推荐答案

答案是您无需执行任何操作.只要这些应用使用相同的数据库(由MONGO_URL标识),它们就会对数据的变化做出反应.

The answer is that you don't have to do anything. As long as the apps use the same database (as identified by the MONGO_URL), they will respond reactively to changes in the data.

实际上,按照本视频为什么要拆分流星应用程序.

您甚至可以使用mongo shell来更新/插入/删除数据库中的文档,出版物将对其进行提取.

You can even use the mongo shell to update/insert/delete documents in the database, and the publications will pick them up.

这篇关于如何-在单个MongoDB上使用多个Meteor应用程序-相同的集合?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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