summaryrefslogtreecommitdiff
path: root/jstests/core/find_and_modify.js
diff options
context:
space:
mode:
authorDan Pasette <dan@10gen.com>2015-01-18 16:13:43 -0500
committerDan Pasette <dan@mongodb.com>2015-01-18 20:04:36 -0500
commitc50f274e1f232c498d411c98d6d0e4ff30df9ec3 (patch)
tree0425729a3ab107786bcd5de29c3294e1a7a70c3d /jstests/core/find_and_modify.js
parent386398eb40626cf44d76f010a8d474b75b3f7adf (diff)
downloadmongo-c50f274e1f232c498d411c98d6d0e4ff30df9ec3.tar.gz
SERVER-16601 error out on conflicting params to findAndModify
Diffstat (limited to 'jstests/core/find_and_modify.js')
-rw-r--r--jstests/core/find_and_modify.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/jstests/core/find_and_modify.js b/jstests/core/find_and_modify.js
index a80859ab60c..fd31ee60fb6 100644
--- a/jstests/core/find_and_modify.js
+++ b/jstests/core/find_and_modify.js
@@ -36,3 +36,11 @@ assert.eq(out.priority, 2);
// return null (was {} before 1.5.4) if no matches (drivers may handle this differently)
out = t.findAndModify({query:{no_such_field:1}, remove:1});
assert.eq(out, null);
+
+// make sure we fail with conflicting params to findAndModify SERVER-16601
+t.insert({x:1});
+assert.throws(function() { t.findAndModify({query:{x:1}, update:{y:2}, remove:true}); });
+assert.throws(function() { t.findAndModify({query:{x:1}, update:{y:2}, remove:true, sort: {x:1}}); });
+assert.throws(function() { t.findAndModify({query:{x:1}, update:{y:2}, remove:true, upsert:true}); });
+assert.throws(function() { t.findAndModify({query:{x:1}, update:{y:2}, new:true, remove:true}); });
+assert.throws(function() { t.findAndModify({query:{x:1}, upsert:true, remove:true}); });