Skip to content

Commit b1daeb7

Browse files
committed
docs(connection): document Connection#models property
Fix #8314
1 parent 33412d9 commit b1daeb7

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

lib/connection.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,27 @@ Connection.prototype.collections;
187187

188188
Connection.prototype.name;
189189

190+
/**
191+
* A [POJO](https://masteringjs.io/tutorials/fundamentals/pojo) containing
192+
* a map from model names to models. Contains all models that have been
193+
* added to this connection using [`Connection#model()`](/docs/api/connection.html#connection_Connection-model).
194+
*
195+
* ####Example
196+
*
197+
* const conn = mongoose.createConnection();
198+
* const Test = conn.model('Test', mongoose.Schema({ name: String }));
199+
*
200+
* Object.keys(conn.models).length; // 1
201+
* conn.models.Test === Test; // true
202+
*
203+
* @property models
204+
* @memberOf Connection
205+
* @instance
206+
* @api public
207+
*/
208+
209+
Connection.prototype.models;
210+
190211
/**
191212
* The plugins that will be applied to all models created on this connection.
192213
*

0 commit comments

Comments
 (0)