You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The Meteor docs say that transform is not applied to Cursors returned from publications. So, if one wanted to not publish individual elements in an array field, they can't do this:
// Publication that wants to omit individual elements from an array fieldMeteor.publish('myPub',function(){returnMyCollection.find({},{transform: (obj)=>{// This function never gets called, so this won't workobj.someArrayField=obj.someArrayField.filter(element=>element!=='someValue');returnobj;},});});
However, this does work:
// Publication that wants to omit individual elements from an array fieldMeteor.publishComposite('myCompositePub',function(){return{find(){returnMyCollection.find({},{transform: (obj)=>{// This function does get called and modifies the published objectobj.someArrayField=obj.someArrayField.filter(element=>element!=='someValue');returnobj;},});},};});
Expected behavior
I would've expected the transform to not work for publishComposite too. Is this intended behaviour or an accidental feature?
Tested on
v1.8.6
The text was updated successfully, but these errors were encountered:
We, the Members of Meteor Community Packages take every issue seriously.
Our goal is to provide long-term lifecycles for packages and keep up
with the newest changes in Meteor and the overall NodeJs/JavaScript ecosystem.
However, we contribute to these packages mostly in our free time.
Therefore, we can't guarantee your issues to be solved within certain time.
If you think this issue is trivial to solve, don't hesitate to submit
a pull request, too! We will accompany you in the process with reviews and hints
on how to get development set up.
Please also consider sponsoring the maintainers of the package.
If you don't know who is currently maintaining this package, just leave a comment
and we'll let you know
The main question I have is whether this behaviour will be kept or removed in future versions; can I make use of transform in publishComposite pubs without fear a future version update breaking the code?
Describe the bug
The Meteor docs say that
transform
is not applied to Cursors returned from publications. So, if one wanted to not publish individual elements in an array field, they can't do this:However, this does work:
Expected behavior
I would've expected the
transform
to not work forpublishComposite
too. Is this intended behaviour or an accidental feature?Tested on
v1.8.6
The text was updated successfully, but these errors were encountered: