diff --git a/lib/collection.js b/lib/collection.js index c8ccc618ae..1ac6c50221 100644 --- a/lib/collection.js +++ b/lib/collection.js @@ -84,7 +84,7 @@ const updateOne = require('./operations/collection_ops').updateOne; * }); */ -const mergeKeys = ['readPreference', 'ignoreUndefined']; +const mergeKeys = ['ignoreUndefined']; /** * Create a new Collection instance (INTERNAL TYPE, do not instantiate directly) @@ -322,7 +322,8 @@ Collection.prototype.find = function(query, options, callback) { : { _id: 1 }; } - let newOptions = {}; + // Make a shallow copy of options + let newOptions = Object.assign({}, options); // Make a shallow copy of the collection options for (let key in this.s.options) { @@ -331,11 +332,6 @@ Collection.prototype.find = function(query, options, callback) { } } - // Make a shallow copy of options - for (let optKey in options) { - newOptions[optKey] = options[optKey]; - } - // Unpack options newOptions.skip = options.skip ? options.skip : 0; newOptions.limit = options.limit ? options.limit : 0;