summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorJason Rassi <rassi@10gen.com>2015-04-25 12:57:35 -0400
committerJason Rassi <rassi@10gen.com>2015-04-28 16:53:26 -0400
commit4ea827d383156d36e666d05eb6dad8bbc2a75801 (patch)
tree3cd082f98883ca77f44b3c69f518472e38fcda6c /jstests
parent659d6c26e12d3396aafff70ca11d74a4187b4084 (diff)
downloadmongo-4ea827d383156d36e666d05eb6dad8bbc2a75801.tar.gz
SERVER-18111 Check userAllowedWriteNS() in findAndModify cmd parsing
(cherry picked from commit 040879f6885395ab49754bd76449af71d0903dd7)
Diffstat (limited to 'jstests')
-rw-r--r--jstests/core/system_profile.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/jstests/core/system_profile.js b/jstests/core/system_profile.js
index 464044aaa1b..abfa0c98832 100644
--- a/jstests/core/system_profile.js
+++ b/jstests/core/system_profile.js
@@ -23,6 +23,15 @@ assert.writeError(testDB.system.profile.update({}, {a: 1}));
assert.writeError(testDB.system.profile.update({}, {a: 1}, {upsert: true}));
assert.writeError(testDB.system.profile.remove({}));
+// Using findAndModify to write to "system.profile" should fail.
+assert.commandWorked(testDB.dropDatabase());
+assert.commandWorked(testDB.createCollection("system.profile"));
+assert.commandFailed(
+ testDB.system.profile.runCommand("findAndModify", {query: {}, update: {a: 1}}));
+assert.commandFailed(
+ testDB.system.profile.runCommand("findAndModify", {query: {}, update: {a: 1}, upsert: true}));
+assert.commandFailed(testDB.system.profile.runCommand("findAndModify", {query: {}, remove: true}));
+
// Using mapReduce to write to "system.profile" should fail.
assert.commandWorked(testDB.dropDatabase());
assert.writeOK(testDB.foo.insert({val: 1}));