diff --git a/lib/drivers/node-mongodb-native/collection.js b/lib/drivers/node-mongodb-native/collection.js index fc9235f6f48..2fb6804c3f4 100644 --- a/lib/drivers/node-mongodb-native/collection.js +++ b/lib/drivers/node-mongodb-native/collection.js @@ -208,14 +208,14 @@ function iter(i) { if (debug) { if (typeof debug === 'function') { - let range = ''; + let argsToAdd = null; if (typeof args[args.length - 1] == 'function') { - range = args.slice(0, args.length - 1); + argsToAdd = args.slice(0, args.length - 1); } else { - range = args.slice(0, args.length); + argsToAdd = args; } debug.apply(_this, - [_this.name, i].concat(range)); + [_this.name, i].concat(argsToAdd)); } else if (debug instanceof stream.Writable) { this.$printToStream(_this.name, i, args, debug); } else {