Search code examples
node.jsmongoose

How to get an object of all models of a Mongoose instance


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.


Solution

  • As of now, there is an offcial way: Mongoose#modelNames().