![](/img/trans.png)
[英]MongoDB and API integration - Create New User if Doesn't Already Exist
[英]Unable to create new user in MongoDB
我已經按照本指南安裝了mongodb
https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-14-04
但是我不知道如何獲取管理員用戶/密碼,甚至創建它。
db.createUser { user: "username",pwd: "monkey123",roles: [{ role: "readWrite", db: "0" } ]}
並得到
2015-11-19T14:18:52.867-0500 E QUERY SyntaxError: Unexpected token {
我遵循mongo docs並獲得了
TypeError: Property 'addUser' of object 0 is not a function
我想要的只是獲得管理員用戶/通行證或成為我自己的用戶,以便可以將nodebb論壇應用程序連接到mongodb。
db.createUser({user: "username", pwd: "monkey123", roles: [{role: "readWrite", db: "0"}]});
您錯過了()
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.