At the moment, there is an opposite means: Mongoose#modelNames().
You can access the object of all your models with mongoose.models. It looks like this:
models:
{ myModel:
{ [Function: model]
modelName: 'myModel',
auth: [Function],
model: [Function: model],
options: undefined,
db: [Object],
schema: [Object],
collection: [Object],
base: [Circular] } },
In my opinion, the poor use of private APIs is bad, so this is a bit of a Mongoose design flaw (see LearnBoost / mongoose # 1362 ).
source
share