meteor-publish-composite icon indicating copy to clipboard operation
meteor-publish-composite copied to clipboard

BUG: if fields option is set on cursor in children, remaining siblings functions don't run

Open serkandurusoy opened this issue 8 years ago • 1 comments

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.

serkandurusoy avatar Jun 26 '16 06:06 serkandurusoy

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.

serkandurusoy avatar Jun 26 '16 06:06 serkandurusoy

@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 avatar Mar 03 '24 22:03 manueltimita

@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.

serkandurusoy avatar Mar 04 '24 08:03 serkandurusoy