Skip to content

Commit

Permalink
docs(connection): document Connection#models property
Browse files Browse the repository at this point in the history
Fix #8314
  • Loading branch information
vkarpov15 committed Nov 20, 2019
1 parent 33412d9 commit b1daeb7
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/connection.js
Expand Up @@ -187,6 +187,27 @@ Connection.prototype.collections;

Connection.prototype.name;

/**
* A [POJO](https://masteringjs.io/tutorials/fundamentals/pojo) containing
* a map from model names to models. Contains all models that have been
* added to this connection using [`Connection#model()`](/docs/api/connection.html#connection_Connection-model).
*
* ####Example
*
* const conn = mongoose.createConnection();
* const Test = conn.model('Test', mongoose.Schema({ name: String }));
*
* Object.keys(conn.models).length; // 1
* conn.models.Test === Test; // true
*
* @property models
* @memberOf Connection
* @instance
* @api public
*/

Connection.prototype.models;

/**
* The plugins that will be applied to all models created on this connection.
*
Expand Down

0 comments on commit b1daeb7

Please sign in to comment.