2 years ago

#56046

test-img

XeroxDucati

Mongoose 3 to 6 and modelSchemas

I'm working on migrating an old project from mongoose 3 to 6 and can't seem to find anything in the change docs about modelSchemas and how they've been superseded.. In some unit tests, I have this v3 code;

function clearModels(models) {
  models.forEach(model => {
    delete mongoose.models[model];
    delete mongoose.modelSchemas[model];
  });
}

This of course fails because mongoose.modelSchemas no longer exists -- so the question is, how do I re-write this in a v6 compatible way?

javascript

node.js

typescript

mongoose

mongoose-populate

0 Answers

Your Answer

Accepted video resources