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.
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!