Skip to content
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

hooks #86

Closed
RuedigerLudwig opened this issue May 20, 2019 · 2 comments
Closed

hooks #86

RuedigerLudwig opened this issue May 20, 2019 · 2 comments
Labels

Comments

@RuedigerLudwig
Copy link

I'm submitting a...


[ ] Regression 
[ ] Bug report
[X] Feature request
[X] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

I want to write a strongy modularized App that uses mongoose as a database. There is a collection, let's say Container, that is agnostic about where it is referenced. It might be in no other module in one or in multiple ones.

The can be an unknown amout of things that needs to be done when a Container is checked or removed. One module might want to protect a container from being removed, when it is still referenced, while another needs to remove an instance in itself. Or a module needs to realize that a field on a Container has been changed and change one on its own.

All this could be achieved with Schema hooks in vanilla mongoose. I just need to expose the Schema of Container before the call to get the Model of the Schema.

Unfortunately I do not see any point in time where I could be sure, to get a Schema, but where ot Model has been created of this. Would it be possible to expose this at a defined point during startup, so that other models could plant their hooks into the already existing Schema?

Thanks

Environment


Nest version: 6.2.2
Nest-mongoose: 6.1.2
 
For Tooling issues:
- Node version: 10.15.3
- Platform:  Ubuntu 18.04

Others:

@felixnotermans
Copy link

+1

@kamilmysliwiec
Copy link
Member

Let's track this here https://github.com/nestjs/docs.nestjs.com/pull/938/files

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

No branches or pull requests

3 participants