Skip to content

Commit 4a1e474

Browse files
committed
fix(Mongoose): fix connection setter
1 parent d90100e commit 4a1e474

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,10 @@ Mongoose.prototype.__defineGetter__('connection', function() {
528528
});
529529

530530
Mongoose.prototype.__defineSetter__('connection', function(v) {
531-
this.connections[0] = v;
531+
if (v instanceof Connection) {
532+
this.connections[0] = v;
533+
this.models = v.models;
534+
}
532535
});
533536

534537
/*!

0 commit comments

Comments
 (0)