Skip to content

Commit 238431e

Browse files
committed
fix: avoid adding every Mongoose instance to global driver
1 parent f5605ed commit 238431e

File tree

2 files changed

+0
-11
lines changed

2 files changed

+0
-11
lines changed

lib/driver.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,10 @@
66

77
let driver = null;
88

9-
const _mongooseInstances = [];
10-
module.exports._mongooseInstances = _mongooseInstances;
11-
129
module.exports.get = function() {
1310
return driver;
1411
};
1512

1613
module.exports.set = function(v) {
1714
driver = v;
18-
19-
for (const mongoose of _mongooseInstances) {
20-
const Connection = driver.getConnection();
21-
mongoose.Connection = Connection;
22-
mongoose.connections = [new Connection(mongoose)];
23-
mongoose.Collection = driver.Collection;
24-
}
2515
};

lib/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ function Mongoose(options) {
7070
}, options);
7171
const conn = this.createConnection(); // default connection
7272
conn.models = this.models;
73-
driver._mongooseInstances.push(this);
7473

7574
if (this.options.pluralization) {
7675
this._pluralize = legacyPluralize;

0 commit comments

Comments
 (0)