Skip to content

Commit

Permalink
Merge pull request #1868 from omarberrami/fix/prevent-reloading-compi…
Browse files Browse the repository at this point in the history
…led-models

Prevent reloading compiled model if already existed
  • Loading branch information
kamilmysliwiec authored Jul 20, 2023
2 parents 5d7be6c + 3d2fe54 commit 720f868
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/mongoose.providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function createMongooseProviders(
{
provide: getModelToken(option.name, connectionName),
useFactory: (connection: Connection) => {
const model = connection.model(
const model = connection.models[option.name] ? connection.models[option.name] : connection.model(
option.name,
option.schema,
option.collection,
Expand Down

0 comments on commit 720f868

Please sign in to comment.