Given two publications for the same collection named Foo. The fooList should only return specific fields but the fooDetail should return the whole document.
Server:<
Your pub/sub looks good. My guess is that you haven't added reactivity to the fooDetail
sub. Do me a favor:
waitOn
on iron router, passing in a static value to fooDetail
.Template.Instance().autorun
This isn't a bug, it's a known limitation of the meteor's MergeBox. It's one of those confusing problems that bites most meteor developers once.
From the docs:
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.
You can see this post for possible workarounds. In your example, you could modify your publish to look like:
Meteor.publish 'fooList', ->
Foo.find {}, fields: foo: 1, bar: 1
That would publish all of the top-level bar
field which avoids the conflict but may not be acceptable in your particular use case.