meteor-vue / vue-meteor-tracker

Use Meteor Tracker reactivity inside Vue components
90 stars 20 forks source link

findOne(_id) cursors do not work with meteor collection hooks #45

Open WayneUong opened 5 years ago

WayneUong commented 5 years ago

I use a few before.find and before.findOne hooks from https://github.com/matb33/meteor-collection-hooks. And they only work outside of the vue meteor tracker. E.g.

If I have hook:

Projects.before.findOne(function (userId, selector, options) {
    selector.removed = null
});

This will work:

methods: {
    findProject () {
        return Projects.findOne('xyz')
    }
}

This will work:

meteor: {
    project () {
        return Projects.findOne({_id: 'xyz'});
    }
}

This will not work:

meteor: {
    project () {
        return Projects.findOne('xyz');
    }
}