Skip to content

Commit

Permalink
Merge pull request #11133 from orgads/connection-states
Browse files Browse the repository at this point in the history
fix(index): export ConnectionStates
  • Loading branch information
vkarpov15 authored Dec 24, 2021
2 parents 89f1302 + cea80bc commit b6eb341
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,15 @@ Mongoose.prototype.cast = cast;
Mongoose.prototype.STATES = STATES;

/**
* Expose connection states for user-land
*
* @memberOf Mongoose
* @property ConnectionStates
* @api public
*/
Mongoose.prototype.ConnectionStates = STATES;

/**
* Object with `get()` and `set()` containing the underlying driver this Mongoose instance
* uses to communicate with the database. A driver is a Mongoose-specific interface that defines functions
* like `find()`.
Expand Down
1 change: 1 addition & 0 deletions test/typescript/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import mongoose from 'mongoose';
const m: mongoose.Mongoose = new mongoose.Mongoose();

m.STATES.connected;
m.ConnectionStates.connected;

m.connect('mongodb://localhost:27017/test').then(() => {
console.log('Connected!');
Expand Down

0 comments on commit b6eb341

Please sign in to comment.