Subscribe same collection with different projection

I’m trying to use 2 subscriptions.

//get all companies id and name
Meteor.publish(‘partial_info’, function () {
return Companies.find({}, {fields: {’_id’: 1,‘’: 1}});

//get specific company full info by id
Meteor.publish(‘full_info’, function (companyId) {
return Companies.find({’_id’: companyId});

I subscribe partial_info on the Tracker.autorun and the full_info only on the page I need to user the full info of the company, but for some reason it seems like the full_info subscription is being override by the partial_info subscription because I don’t get the full info of the company (the info field is not updated or being filled).
I tried excluding a specific companyId from the partial_info subscription and then subscribe to its full_info and it worked…
What should I do?Vjau, please stop…

Why do you limit the fields in the first place ? Security ? Optimization ?

There are many companies and each one has many fields.
At first I just show them all on a grid displaying their name and then I want to show the chosen company’s full info.

One possibility would be to require the complete company info with a method.

I want to use subscription because I want the company to be reactive

Another solution would be to have two collections, but you would have to synchronize them.

This is a guess, but have you tried specifying every field you want in the fields field for your second query? It could be that mergeBox deems it unnecessary to fetch more data as you didn’t specify…

Hi flintchip,
Yes, I tried it but it didn’t help…

Hey, have you tried with template-level-subscriptions?

The subscriptions stop when you leave the route and probably you’ll avoid the data-override

Take a look at the following article (blaze):

It should be something like this (don’t use Tracker.autorun nor Meteor.subscribe)

Template.yourTemplateName.onCreated(function () {

  // Current template instance
  var instance = this;

  instance.autorun(function () {
       var subs = instance.subscribe("your-subscription"); // subscription will stop when the view is destroyed

Hope it helps!

From the Meteor documentation:

If more than one subscription sends conflicting values for a field (same collection name, document ID, and field name), then the value on the client will be one of the published values, chosen arbitrarily.

I’m bumping into the same issue and I’m going to try the work around mentioned in this blog. I guess it has to do with how Meteor handles projections in the MergeBox.