Closed evolross closed 5 years ago
Haven't looked at the code for a while, but thinking that some fiber environment variable is being set and as the update on anotherCollection is run in the same fiber or a cloned fiber environment it also runs in direct mode.
But not sure
Just ran into this again... and figured something out as a work-around/solution (after a lot of shots in the dark). If you throw in a CollectionHooks.directEnv = new Meteor.EnvironmentVariable(false)
like so:
someCollection.direct.update({...}, function(error) {
if(!error) {
CollectionHooks.directEnv = new Meteor.EnvironmentVariable(false);
anotherCollection.update({...});
}
});
It disregards the direct
on the second update. Thanks for the advice. It was indeed a fiber environment variable.
Version:
matb33:collection-hooks@0.9.0-rc.4
Just reporting for the heck of it - I know this really isn't supported anymore, but it works for the most part. If I get time I may try to work on this.
In server code I have:
The update to
anotherCollection
gets thedirect
bypasser forced onto it.