mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
avoid recompile db models
This commit is contained in:
parent
5d37f6a4a6
commit
2750340fd0
@ -10,7 +10,11 @@ function generateModels() {
|
||||
dirs.forEach((file) => {
|
||||
const model = require(path.join(__dirname, file)).default
|
||||
|
||||
models[model.name] = mongoose.model(model.name, new Schema(model.schema), model.collection)
|
||||
if (mongoose.model[model.name]) {
|
||||
return models[model.name] = mongoose.model(model.name)
|
||||
}
|
||||
|
||||
return models[model.name] = mongoose.model(model.name, new Schema(model.schema), model.collection)
|
||||
})
|
||||
|
||||
return models
|
||||
|
Loading…
x
Reference in New Issue
Block a user