Skip to content

Commit 44a4110

Browse files
Sam Palmbroadst
Sam Pal
authored andcommitted
feat(Update): add the ability to specify a pipeline to an update command (#2017)
* feat(Update): add the ability to specify a pipeline to an update command NODE-1920
1 parent 346cedb commit 44a4110

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/collection.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,15 @@ Collection.prototype.updateOne = function(filter, update, options, callback) {
697697
if (typeof options === 'function') (callback = options), (options = {});
698698
options = options || {};
699699

700-
const err = checkForAtomicOperators(update);
700+
let err;
701+
if (Array.isArray(update)) {
702+
for (let i = 0; !err && i < update.length; i++) {
703+
err = checkForAtomicOperators(update[i]);
704+
}
705+
} else {
706+
err = checkForAtomicOperators(update);
707+
}
708+
701709
if (err) {
702710
if (typeof callback === 'function') return callback(err);
703711
return this.s.promiseLibrary.reject(err);

0 commit comments

Comments
 (0)