summaryrefslogtreecommitdiff
path: root/src/mongo/shell
diff options
context:
space:
mode:
authorBernard Gorman <bernard.gorman@gmail.com>2019-05-09 02:01:08 +0100
committerBernard Gorman <bernard.gorman@gmail.com>2019-05-10 12:52:45 +0100
commit848b0c21638d6b1731385d0ead2d138b6c436515 (patch)
tree8b0438358c2456b803d94821aa79a39b11e45547 /src/mongo/shell
parent1d2038b2b84172abbe06ead3a2fa80f833998651 (diff)
downloadmongo-848b0c21638d6b1731385d0ead2d138b6c436515.tar.gz
SERVER-40408 Ban pipeline-style syntax in the shell's Bulk replaceOne function
Diffstat (limited to 'src/mongo/shell')
-rw-r--r--src/mongo/shell/bulk_api.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mongo/shell/bulk_api.js b/src/mongo/shell/bulk_api.js
index f52135c6e03..b18189636d1 100644
--- a/src/mongo/shell/bulk_api.js
+++ b/src/mongo/shell/bulk_api.js
@@ -708,6 +708,10 @@ var _bulk_api_module = (function() {
},
replaceOne: function(updateDocument) {
+ // Cannot use pipeline-style updates in a replacement operation.
+ if (Array.isArray(updateDocument)) {
+ throw new Error('Cannot use pipeline-style updates in a replacement operation');
+ }
findOperations.updateOne(updateDocument);
},