Skip to content

Commit 2b3566d

Browse files
authored
Merge pull request #152 from share/fix-mongo-count-leak
Resolve memory leak when using cursor operations like $count in mongodb@4-6
2 parents 5e6fc4c + 3410c26 commit 2b3566d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1510,12 +1510,14 @@ var cursorOperationsMap = {
15101510
$count: function(cursor, value, cb) {
15111511
cursor.count()
15121512
.then(function(result) {
1513+
cursor.close();
15131514
cb(null, result);
15141515
}, cb);
15151516
},
15161517
$explain: function(cursor, verbosity, cb) {
15171518
cursor.explain(verbosity)
15181519
.then(function(result) {
1520+
cursor.close();
15191521
cb(null, result);
15201522
}, cb);
15211523
},

0 commit comments

Comments
 (0)