We’ve been working with mongoose@^5.4.11 and due to the MongoDB Server upgrade to 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.
I think I have things working again by changing the code to:
Model.base.model(modelName).schema.paths
Could someone confirm this change is exactly equivalent to the original statement?