Multiple publish for the same collection, different conditions/filtering

First of all, greetings to everyone here. I’m new here, I’m new to Meteor, and this is my first post.

As usual, reactivity is what drove me to Meteor, much like everyone else. So, the goal is to maintain that.

Use case
Suppose you have a Client collection. There are 10 clients in that collection.

Here is what you want to do, at the same time:

  • Print the total number of Clients
  • Show a list of Clients filtered by some conditions

The challenge
The problem I faced, is that when I create a subscription, for example “all-clients”, “filtered-clients”, they all go to the same mini-mongo to the Client side. And I am not sure how do I get each one without mixing them. When I subscribe to “all-clients”, the list is full (10 people, 10 items in the list); and when I subscribe to “filtered-clients”, both are also updating to fewer people/items.

The Question
How do I separate these two? This is just example of 2 items, but I could think of situations where more than 3 conditions are required.

I am planning to move my project to React; that might be relevant.

1 Like

This approach is one of the most common ways of handling this issue.

Thanks for that. So, it’s like sending distinct subscriptions to distinct templates. Makes sense indeed, especially given the fact that you can subscribe to a publication right within templates.

Unfortunately the Merge Box is not mentioned in the Meteor Documentation. It is something that stumped me when I started with Meteor (what seems) 100 years ago …

The good news is that mergebox is now mentioned in the Meteor Guide.

1 Like