blob: 821d6ef5166be768ec70e6ec4d98e86bf9e3e593 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
/**
* Tests that users are disallowed from writing to the system.views collecion.
*
* @tags: [
* requires_non_retryable_writes,
* requires_fcv_47,
* ]
*/
(function() {
"use strict";
const viewNs = "test.view";
const viewDefinition = {
_id: viewNs,
viewOn: "coll",
pipeline: []
};
const invalidField = {
invalidField: true
};
assert.commandFailedWithCode(db.system.views.insert(viewDefinition), ErrorCodes.InvalidNamespace);
assert.commandFailedWithCode(db.system.views.update({}, invalidField), ErrorCodes.InvalidNamespace);
assert.commandFailedWithCode(
db.runCommand({findAndModify: "system.views", query: {}, update: invalidField}),
ErrorCodes.InvalidNamespace);
assert.commandFailedWithCode(db.system.views.remove({}), ErrorCodes.InvalidNamespace);
})();
|