8000 feature request: afterCreate · Issue #1 · fzaninotto/mongoose-lifecycle · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feature request: afterCreate #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
0xgeert opened this issue Jun 25, 2012 · 2 comments
Open

feature request: afterCreate #1

0xgeert opened this issue Jun 25, 2012 · 2 comments

Comments

@0xgeert
Copy link
0xgeert commented Jun 25, 2012

Consider the use-case where a model instance needs to do some initialization DIRECTLY after it has been created, based on the properties that particular instance is created with.

This would enable controllers to interact with the just created model instance, while being able to rely on the logic defined in afterCreate to have fired.

As of now, there's no hook to support this afaik. (e.g; pre(init) only works on the init of a schema not a schema instance).

It would be great if this could somehow be supported.

Best,
Geert-Jan

@fzaninotto
Copy link
Owner

I think the feature you're asking for is Plugins: http://mongoosejs.com/docs/plugins.html

@robbrit
Copy link
robbrit commented Dec 30, 2012

@gbrits: This is handled by the mongoose-lifecycle plugin: https://github.com/fzaninotto/mongoose-lifecycle

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

No branches or pull requests

3 participants
0