From 4a1e47488428548355e912af108ebd210087afe4 Mon Sep 17 00:00:00 2001 From: Lin Qun Date: Tue, 5 Dec 2017 22:36:42 +0800 Subject: [PATCH] fix(Mongoose): fix connection setter --- lib/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index e76a57eb436..ea6ffe1001a 100644 --- a/lib/index.js +++ b/lib/index.js @@ -528,7 +528,10 @@ Mongoose.prototype.__defineGetter__('connection', function() { }); Mongoose.prototype.__defineSetter__('connection', function(v) { - this.connections[0] = v; + if (v instanceof Connection) { + this.connections[0] = v; + this.models = v.models; + } }); /*!