check if model exist

This commit is contained in:
SrGooglo 2023-07-13 18:10:45 +00:00
parent 95753adbaa
commit 47b7c51689

View File

@ -10,7 +10,7 @@ function generateModels() {
dirs.forEach((file) => {
const model = require(path.join(__dirname, file)).default
if (mongoose.model[model.name]) {
if (mongoose.models[model.name]) {
return models[model.name] = mongoose.model(model.name)
}