Meteor-Community-Packages / meteor-collection-hooks

Meteor Collection Hooks
https://atmospherejs.com/matb33/collection-hooks
MIT License
658 stars 90 forks source link

Unsafe selector in find/(findOne) #214

Closed zimme closed 7 years ago

zimme commented 7 years ago

So I got this report zimme/meteor-collection-softremovable#26 which was started in meteor/meteor#8220.

It basically uncovered a problem in in my find/findOne before hook logic where I was always initializing selector if it was undefined which was a problem because I made the assumption that when you do collection.find(), selector would be undefined but it turns out that that's not the case. Instead meteor checks for arguments length and if it's 0 then it sets selector to {}.

So I removed this logic and things started working as expected on the server but then I saw that the selector in the hooks on client and server isn't mirroring and it has to do with this line.

It uses different collections on client/server and it seems that somewhere along the line the safe find selector is getting lost in the client collection.

I'm having a hard time tracking this down and thought you might have some thoughts?

zimme commented 7 years ago

Will be fixed in next version.