Model.base.modelSchemas undefined when upgrading to mongoose 6

Hi everybody,

We’ve been working with mongoose@^5.4.11 and due to the MongoDB Server upgrade version 5, we are upgrading to mongoose@6.1.7.

In our code we have this line:

Model.base.modelSchemas[modelName].paths

after upgrading to 6.1.7 I get undefined for modelSchemas.

I cloned the mongoose repo for tag 5.4.11, and there modelSchemas is a property of the Mongoose class in ‘lib/index.js/’

I also cloned the mongoose repo for tag 6.1.7, and there modelSchemas is not defined anywhere (only see mentions of it in docs files)

In the mongoose migration guide 5 to 6 modelSchemas is not mentioned anywhere.

So I don’t really understand what is going on, and what I should use to replace this code.

thanks!