Skip to content

[email protected] causes issues #2479

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

Closed
1 task done
sagyeli opened this issue Jan 30, 2017 · 11 comments · Fixed by #2498
Closed
1 task done

[email protected] causes issues #2479

sagyeli opened this issue Jan 30, 2017 · 11 comments · Fixed by #2498

Comments

@sagyeli
Copy link

sagyeli commented Jan 30, 2017

  • I understand that GitHub issues are not for tech support, but for questions specific to this generator, bug reports, and feature requests.
Item Version
generator-angular-fullstack 4.1.2
Node 4.5.0
npm 3.10.2
Operating System Windows 10
etc etc
Item Answer
Transpiler Babel / TypeScript
Markup HTML / Pug
CSS CSS / LESS / SCSS / Stylus
Router ngRoute / ui-router
Client Tests Jasmine / Mocha
DB MongoDB / SQL
Auth Y / N
etc etc

Please be aware: the following event on thing.events.js does not work: Thing.schema.post(e, emitEvent(event));, since Thing.schema.post event is not triggered with [email protected]

@sagyeli sagyeli changed the title [email protected] causes issues with [email protected] causes issues Jan 30, 2017
@Awk34
Copy link
Member

Awk34 commented Jan 30, 2017

Are you sure there is a Mongoose issue here? I don't see anything breaking in the 4.8.0 changelog

@gordonaspin
Copy link

+1 I had same problem with Thing.schema.post(e, emitEvent(event)) not emitting events in mongoose 4.8.1, downgraded to mongoose 4.7.7 and everything ok. Also, I would suggest adding ghostMode: false to the browsersync config in server/config/express.js as the default.

@Awk34
Copy link
Member

Awk34 commented Feb 3, 2017

Have either of you submitted a bug report to Mongoose yet?

@gordonaspin
Copy link

gordonaspin commented Feb 3, 2017 via email

@Awk34
Copy link
Member

Awk34 commented Feb 3, 2017

From reading this bug report, it seems like there might have been an unintended breaking API change in mongoose 4.8.0

@EliKrumholz
Copy link

I think I was able to replicate the bug, I opened an issue with mongoose: Automattic/mongoose#4955

@EliKrumholz
Copy link

From the Mongoose folks:

mutating the underlying schema after the Thing model has been created by mongoose.model() isn't a supported behavior. Make sure you define all your hooks before calling mongoose.model()

@ernisto has a solution in #2491 that does just that.

@alkiko
Copy link

alkiko commented Feb 7, 2017

Downgrading to 4.7.9 solved it for me too, but @ernisto's suggestion looks more correct.

@Awk34
Copy link
Member

Awk34 commented Feb 7, 2017

@ernisto do you thing you might submit a Pull Request for your fix?

@Climax777
Copy link

+1 for the @ernisto fix

@ernistkg
Copy link

ernistkg commented Feb 9, 2017

@Awk34 Yes it would be Great! But I need some time to create Pull Request according to rules and best practices.

kingcody added a commit to kingcody/generator-angular-fullstack that referenced this issue Feb 11, 2017
As of `[email protected]` schema events should be registered before the model is compiled

fixes angular-fullstack#2479
Awk34 pushed a commit that referenced this issue May 13, 2017
As of `[email protected]` schema events should be registered before the model is compiled

fixes #2479
Awk34 pushed a commit that referenced this issue May 14, 2017
As of `[email protected]` schema events should be registered before the model is compiled

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

Successfully merging a pull request may close this issue.

7 participants