Content-Type: text/x-zim-wiki Wiki-Format: zim 0.4 Creation-Date: 2021-02-08T17:41:13-08:00 ====== Results1 ====== Created Monday 08 February 2021 ''' $ mongo localhost:27017/admin MongoDB shell version v4.9.0-alpha4-145-gf477293 connecting to: mongodb://localhost:27017/admin?compressors=disabled&gssapiServiceName=mongodb Implicit session: session { "id" : UUID("d18ac634-ad7d-4601-b5b6-35c3c41060c9") } MongoDB server version: 4.9.0-alpha4-145-gf477293 --- The server generated these startup warnings when booting: 2021-02-08T17:35:32.559-08:00: This is a development version of MongoDB. Not recommended for production 2021-02-08T17:35:32.559-08:00: version: 4.9.0-alpha4-145-gf477293 2021-02-08T17:35:32.559-08:00: Soft rlimits for open file descriptors too low 2021-02-08T17:35:32.559-08:00: currentValue: 1024 2021-02-08T17:35:32.559-08:00: recommendedMinimum: 64000 --- MongoDB Enterprise > db.createUser({ user: "root", pwd: "uno-dos-tres-4-5-6", roles: [ "__system" ] }); Successfully added user: { "user" : "root", "roles" : [ "__system" ] } MongoDB Enterprise > db.auth("root", "uno-dos-tres-4-5-6") 1 MongoDB Enterprise > db.sysroles.insert( { "_id" : "admin.root-equivalent", "role" : "root-equivalent", ... "db" : "admin", "privileges" : [ ], "roles" : [ { "role" : "root", "db" : "admin" } ] }) WriteResult({ "nInserted" : 1 }) MongoDB Enterprise > db.createView("test", "test2", []) { "ok" : 1 } MongoDB Enterprise > var uuid=db.getCollectionInfos({name:"system.views"}).map(x => x.info.uuid)[0] MongoDB Enterprise > db.runCommand({applyOps: [{ "ts" : Timestamp(1612816794, 3), "t" : NumberLong(1), ... "h" : NumberLong("-6019319465001995568"), "v" : 2, "op" : "i", ... "ns" : "admin.system.views", "ui" : uuid, ... "wall" : ISODate("2021-02-08T20:39:54.937Z"), "o" : ... { "_id" : "admin.system.roles", "viewOn" : "sysroles", "pipeline" : [ ] } }]}) { "applied" : 1, "results" : [ true ], "ok" : 1 } MongoDB Enterprise > db.system.views.find() { "_id" : "admin.test", "viewOn" : "test2", "pipeline" : [ ] } { "_id" : "admin.system.roles", "viewOn" : "sysroles", "pipeline" : [ ] } MongoDB Enterprise > db.system.roles.find() { "_id" : "admin.root-equivalent", "role" : "root-equivalent", "db" : "admin", "privileges" : [ ], "roles" : [ { "role" : "root", "db" : "admin" } ] } MongoDB Enterprise > db.createUser({ user: "root-eq", pwd: "uno-dos-tres-4-5-6", roles: [ "root-equivalent" ] }); uncaught exception: Error: couldn't add user: Namespace admin.system.roles is a view, not a collection : _getErrorWithCode@src/mongo/shell/utils.js:25:13 DB.prototype.createUser@src/mongo/shell/db.js:1278:11 @(shell):1:1 '''