Skip to content

Commit

Permalink
feat(Update): add the ability to specify a pipeline to an update comm…
Browse files Browse the repository at this point in the history
…and (#2017)

* feat(Update): add the ability to specify a pipeline to an update command

NODE-1920
  • Loading branch information
Sam Pal authored and mbroadst committed Oct 14, 2019
1 parent 346cedb commit dd47215
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,15 @@ Collection.prototype.updateOne = function(filter, update, options, callback) {
if (typeof options === 'function') (callback = options), (options = {});
options = options || {};

const err = checkForAtomicOperators(update);
let err;
if (Array.isArray(update)) {
for (let i = 0; !err && i < update.length; i++) {
err = checkForAtomicOperators(update[i]);
}
} else {
err = checkForAtomicOperators(update);
}

if (err) {
if (typeof callback === 'function') return callback(err);
return this.s.promiseLibrary.reject(err);
Expand Down

0 comments on commit dd47215

Please sign in to comment.