Files
mongo/jstests/auth/system_buckets_invalid_nss.js
Zac 591928c619 SERVER-108478 JS formatted by prettier and remove clang-format (#39656)
GitOrigin-RevId: 6c8f6aded47f260aa4f7c231b17dae3302cb1e04
2025-08-21 17:27:09 +00:00

16 lines
622 B
JavaScript

// Validate that *.system.buckets.system.buckets.* is an invalid namespace
function runTest(conn) {
const admin = conn.getDB("admin");
assert.commandWorked(admin.runCommand({createUser: "admin", pwd: "admin", roles: ["root"]}));
assert.commandFailedWithCode(admin.system.buckets.system.buckets.foo.insert({x: 1}), [ErrorCodes.Unauthorized]);
assert(admin.auth("admin", "admin"));
assert.commandFailedWithCode(admin.system.buckets.system.buckets.foo.insert({x: 1}), [ErrorCodes.InvalidNamespace]);
}
const mongod = MongoRunner.runMongod({auth: ""});
runTest(mongod);
MongoRunner.stopMongod(mongod);