meteor-publish-composite
meteor-publish-composite copied to clipboard
BUG: if fields option is set on cursor in children, remaining siblings functions don't run
When we want to publish multiple children to a parent, if one of the children restricts the cursor to some fields, then the remainin children's functions don't even run and publication never sends ready()
effectively blocking its subscriptions forever.
For example:
Meteor.publishComposite('pub', function() {
return {
find: function() {
return coll1.find()
},
children: [
{
find: function() {
// note that presence of _id:1 does not affect the result
return coll2.find({}, {fields: {_id:1, foo:1}})
}
},
{
find: function() {
console.log(' I WONT EVEN RUN !!!')
return coll3.find()
}
}
]
}
})
And thank you @reywood I am an avid user of this package. And I'd really appreciate if you could take the time to resolve this, since this is an officilly recommended package on the Meteor Guide!
PS: I tried to take a stab at it but honestly could not see what part of the codewould have been responsible for imposing this subtle restriction.
Oh and additionally, switching the order is a workaround. And if there are multiple cursor with fields limitations, than they must be separated into different children blocks, so that calls for rearchitecting the parent publication(s) as well.
@StorytellerCZ I suggest to close this issue as it may have been solved since it was first reported (2016!). I cannot reproduce it with the current version. Also, in production, we have several publications with upwards to 8 children (one level nesting only), where literally every child has projected fields, some with just two or three fields enabled. No issue such as the one described here.
@serkandurusoy If you are still around and encountering this problem, please provide additional details.
@manueltimita thank you for the house cleaning. I haven't been using Meteor for a long time now and don't have the means to confirm the status. I'll happily take your word for it.