我有一个在ubuntu上运行mongodb 2.6的测试服务器.我的macbook上运行的是同一个版本.在这两台机器中,我都使用标准升级机制从mongodb 2.4升级.现在我需要设置基于用户名和密码的身份验证
在我的mac电脑上,我使用brew update将mongodb更新为2.6.我
我在Mac上try 了以下命令
$mongo
>db.getSiblingDatabase('admin')
>db.createUser({user:"root", pwd:"mycomplexpassword", roles:[ "userAdminAnyDatabase", "readWrite" ] } )
我犯了以下错误
Error: couldn't add user: User and role management commands require auth data to have schema version 3 but found 1 at src/mongo/shell/db.js:1004
因此,我无法启用mongodb的身份验证.如何解决这个问题?谷歌搜索错误现在似乎没有返回任何有用的信息.
PS:当我在我的服务器上向mongodb添加身份验证时,是否也会出现同样的问题?