Meteor.publish: publish a collection that depends on another collection

综合技术 Hello, buddy! (源链)

I have a publish function as follows:

Meteor.publish('tasks', function (name) {
    var project = Projects.findOne({name: name});

    return Tasks.find({projectId: project._id});

Now assume that at some point changes are made to Projects with the result that the above Projects.findOne
returns a different project and so the Tasks.find will return other tasks. However the changes made to Projects doesn’t republish the tasks

I’ve used reactivePublish, but it turns out the package has issues (and also does not have any unit tests). So, is there an easy way to make this publish function re-publish when project changes ?


As of this writing, reactive joins are an unsolved problem. For a complete overview see Reactive Joins In Meteor


I strongly
recommend against using observeChanges
directly. It’s incredibly hard to get right, and easy to develop a memory leak. If you don’t believe me, watch this video
on EventedMind. It will make your eyes bleed.

There are several package-based solutions
to this problem. The meteor guide
recommends publish-composite

If you find the idea of using a package-based solution to be unacceptable, have a close look at the Joining On The Client
section from Reactive Joins In Meteor
. It’s clean but requires more waiting on the user’s part. Also see my post on template joins
if you prefer to active your subscriptions at the template level.


Meteor import all files into a directory I'm having an issue while trying to import all files in one of my directories. This works: import '../pages/guidance/target_access_client_relat...
Developing Real-time Apps with Meteor TL;DR:In this tutorial, I'll show you how easy it is to build a real-time web application with Meteor. Check out the repo to get the code. Meteor...
it possible use a nodejs package inside meteor app... it posible use a nodejs package inside meteor app on server side? It would be great to do that since nodejs has a large number of packages. ...
Connecting a Meteor back-end to a React Native app... Introduction In the last few weeks, I was very intrigued by React native. I kept seeing more and more articles like this one , so I decided to take...
Meteoric: Meteor + Ionic Demo A... I have started to read more about Meteor for Mobile App Development. Some people say Meteoric (Meteor + Ionic) is one of the best solutions to achie...
Hello, buddy!责编内容来自:Hello, buddy! (源链) | 更多关于

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » Meteor.publish: publish a collection that depends on another collection

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录