Skip to content
This repository has been archived by the owner on Sep 26, 2020. It is now read-only.

Broken with Mongoose 4.0.3 #1

Open
sabrehagen opened this issue May 25, 2015 · 6 comments
Open

Broken with Mongoose 4.0.3 #1

sabrehagen opened this issue May 25, 2015 · 6 comments

Comments

@sabrehagen
Copy link

Hi,

This seems to be broken with the release of Mongoose 4.x. Could you possibly update it so that we who depend on you can move to the new releases?

Thanks!

@chrisvdb
Copy link

I would also be grateful if this could be ported to Mongoose 4.x.

@sabrehagen
Copy link
Author

Any update on this?

@tarqd
Copy link
Owner

tarqd commented Jul 17, 2015

Sorry I've stopped using this plugin in production and I haven't had much time to maintain it. I'd be happy to accept any pull requests though! If I do get a chance I'll look into it

@andrezero
Copy link

:-( do you have any idea of where to find another plugin that works with current version and provides this functionality?

@tarqd
Copy link
Owner

tarqd commented Jun 29, 2016

Sorry I'm not aware of any other plugins for the new versions, if anyone has suggestions I would be happy to link to it in the readme though

@tarqd
Copy link
Owner

tarqd commented Jun 29, 2016

Something like this might work (not exactly a hook but maybe it'll work for you):

function constructPlugin(schema) {
    schema.methods.$constructHookPluginFn = function () {
        this.emit('construct');
    }
    schema.queue('$constructHookPluginFn', []);
}

myschema.plugin(constructPlugin);
myschema.post('construct', myHookHandler);

The hook system has changed since the last version this worked with and I'm not sure what the best route to go is. Here we are just adding a method to the model that is called with the queue function. This triggers an event which should get handled with the post hook

I'll try to test this out when I get a chance

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants