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

Separate mongoose and connection in options param #29

Open
antonio-spinelli opened this issue Oct 14, 2020 · 1 comment
Open

Separate mongoose and connection in options param #29

antonio-spinelli opened this issue Oct 14, 2020 · 1 comment

Comments

@antonio-spinelli
Copy link

I found a problem installing plugin to a Schema when I use it with NestJs/Mongoose. The only instance that I can access is the Connection mongoose class and it's not fully compatible with the mongoose option needed by the plugin.
I use an ugly way to solve this in my project:

constructor(@InjectConnection() private readonly connection: Connection) {}

...

;(this.connection as any).Schema = mongoose.Schema
schema.plugin(MongooseHistoryPlugin({mongoose: this.connection}))

Can you split those 2 in options or use require mongoose for static Schema calls and ask only for connection instance?
Both options will not generate breaking changes.
I can make a PR if you want.

PS: a typescript interface with all new document methods will be cool

@cdunlap
Copy link

cdunlap commented Mar 24, 2022

Year and a half later, this helped me. Thank you. I think this project is dead though, considering 2 years of no updates and 12 PR's that haven't been merged.

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

2 participants