草庐IT

Createuser

全部标签

mongodb - 语法错误 : missing ) after argument list @(shell):2:4

当我在shell中输入以下内容时,我在MongoDB中遇到了上述错误,但我无法终生看到哪里有语法错误...db.createUser(..."user":"dbTest",..."pwd":"testPass",..."roles":[...{"role":"readWrite","db":"test"}...]...)这是直接从控制台复制和粘贴的。 最佳答案 您在对象文字周围缺少花括号:db.createUser({"user":"dbTest","pwd":"testPass","roles":[{"role":"readWri

MongoDB:了解 createUser 和 db admin

我的MongoDB托管在compose.io上,名为ScroungeBA。我尝试创建一个具有一些内置角色的用户,这些角色在纪录片中仅适用于管理数据库:MongoDBprovidesallotherbuilt-inrolesonlyontheadmindatabase所以我的问题是:那个admindb是关于什么的?是一直存在的标准数据库吗?此外,我遇到了麻烦(使用MongoDBshell版本:3.0.5):$useadminswitchedtodbadmin$db.auth("user","secret")Error:18Authenticationfailed.我猜我的用户确实存在于S

MongoDB:了解 createUser 和 db admin

我的MongoDB托管在compose.io上,名为ScroungeBA。我尝试创建一个具有一些内置角色的用户,这些角色在纪录片中仅适用于管理数据库:MongoDBprovidesallotherbuilt-inrolesonlyontheadmindatabase所以我的问题是:那个admindb是关于什么的?是一直存在的标准数据库吗?此外,我遇到了麻烦(使用MongoDBshell版本:3.0.5):$useadminswitchedtodbadmin$db.auth("user","secret")Error:18Authenticationfailed.我猜我的用户确实存在于S

mongodb - 错误 : couldn't add user: not authorized on test to execute command { createUser:

我从MongoDB开始,我想通过用户/传递对dbs的访问。我做的第一件事是创建和管理用户并使用authactivate启动mongodb,这是我创建的用户:db.getUser("admin"){"_id":"admin.admin","user":"admin","db":"admin","roles":[{"role":"dbAdminAnyDatabase","db":"admin"},{"role":"clusterAdmin","db":"admin"}]}}之后,我尝试使用以下命令创建用户:usenewdbdb.createUser({user:"newuser",pwd:

mongodb - 错误 : couldn't add user: not authorized on test to execute command { createUser:

我从MongoDB开始,我想通过用户/传递对dbs的访问。我做的第一件事是创建和管理用户并使用authactivate启动mongodb,这是我创建的用户:db.getUser("admin"){"_id":"admin.admin","user":"admin","db":"admin","roles":[{"role":"dbAdminAnyDatabase","db":"admin"},{"role":"clusterAdmin","db":"admin"}]}}之后,我尝试使用以下命令创建用户:usenewdbdb.createUser({user:"newuser",pwd:

mongodb - "db.createUser is not a function"和 "password can' 为空”

我正在尝试在MongoDB上设置身份验证。我已在配置文件中取消注释auth=true并重新启动服务器。通过mongo的第一个连接被拒绝。第二个(紧接着第一个)通过了,我在日志中得到了这个:SatApr1214:56:46[initandlisten]connectionacceptedfrom127.0.0.1:44001#1SatApr1214:56:46[conn1]note:nousersconfiguredinadmin.system.users,allowinglocalhostaccess在控制台中,我可以执行命令,但是如果我尝试遵循任何大量教程(包括官方教程),我会得到d
12