Skip to content

Commit

Permalink
Merge pull request #152 from share/fix-mongo-count-leak
Browse files Browse the repository at this point in the history
Resolve memory leak when using cursor operations like $count in mongodb@4-6
  • Loading branch information
ericyhwang committed Feb 13, 2024
2 parents 5e6fc4c + 3410c26 commit 2b3566d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1510,12 +1510,14 @@ var cursorOperationsMap = {
$count: function(cursor, value, cb) {
cursor.count()
.then(function(result) {
cursor.close();
cb(null, result);
}, cb);
},
$explain: function(cursor, verbosity, cb) {
cursor.explain(verbosity)
.then(function(result) {
cursor.close();
cb(null, result);
}, cb);
},
Expand Down

0 comments on commit 2b3566d

Please sign in to comment.