needle-innovision / nestjs-tenancy

Multi-tenancy approach for nestjs - currently supported only for mongodb with mongoose
MIT License
187 stars 58 forks source link

Update tenancy.factory.ts #17

Closed jordanberry closed 2 years ago

jordanberry commented 2 years ago

In my solution, I am hitting a cannot overwrite model after compiled error. By adding this line of logic, it will check if the mongoose model exists and return that for a particular connection rather than trying to overwrite it. Appreciate the great repo.

I borrowed this solution from several blogs that mention the challenge with mongoose like this one: https://nesin.io/blog/fix-mongoose-cannot-overwrite-model-once-compiled-error

Thanks!

sandeepsuvit commented 2 years ago

Hi @jordanberry Thanks for submitting the PR.

Updated the version to v1.0.21. Please verify your changes in the version specified

jordanberry commented 2 years ago

Is working great - thanks for merging!