Content-Type: text/x-zim-wiki Wiki-Format: zim 0.4 Creation-Date: 2021-02-08T17:40:23-08:00 ====== Results2 ====== Created Monday 08 February 2021 ''' (python3-venv) sgmongo@melandru:~/Projects/2021/mongo$ 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("adb7d790-72b6-4a31-85dc-9a5aa00593df") } MongoDB server version: 4.9.0-alpha4-145-gf477293 --- The server generated these startup warnings when booting: 2021-02-08T17:37:56.734-08:00: This is a development version of MongoDB. Not recommended for production 2021-02-08T17:37:56.734-08:00: version: 4.9.0-alpha4-145-gf477293 2021-02-08T17:37:56.734-08:00: Soft rlimits for open file descriptors too low 2021-02-08T17:37:56.734-08:00: currentValue: 1024 2021-02-08T17:37:56.734-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.createRole({ role: "root-equivalent", privileges: [], roles: [ "root" ] }); { "role" : "root-equivalent", "privileges" : [ ], "roles" : [ "root" ] } MongoDB Enterprise > db.createUser({ user: "root-eq", pwd: "uno-dos-tres-4-5-6", roles: [ "root-equivalent" ] }); Successfully added user: { "user" : "root-eq", "roles" : [ "root-equivalent" ] } MongoDB Enterprise > db.system.roles.renameCollection("sysroles"); { "ok" : 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.auth("root-eq", "uno-dos-tres-4-5-6") Error: Authentication failed. 0 '''