I know that mongoose.model("myModel") returns the myModel model. But how can I get Mongoose to give me an array/object/list of all models, that are currently registered?
I think that somewhat is a design flaw.
As of now, there is an offcial way: Mongoose#modelNames().
You can access an object of all your models via mongoose.models.
This looks like that:
models:
{ myModel:
{ [Function: model]
modelName: 'myModel',
auth: [Function],
model: [Function: model],
options: undefined,
db: [Object],
schema: [Object],
collection: [Object],
base: [Circular] } },
In my opinion fiddling around with API private stuff is bad, so this is a little bit of a design flaw of Mongoose (See LearnBoost/mongoose#1362).