ServerSideSkittles
ServerSideSkittles

Reputation: 2973

Unable to create new user in MongoDB

I have installed mongodb as per this guide

https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-14-04

However I have no idea how to fetch the admin user/pass or even create it.

db.createUser { user: "username",pwd: "monkey123",roles: [{ role: "readWrite", db: "0" } ]}

and get

2015-11-19T14:18:52.867-0500 E QUERY    SyntaxError: Unexpected token      {

I follow the mongo docs and get this also

TypeError: Property 'addUser' of object 0 is not a function

All I want is to get the admin user/pass or make my own user so I can connect the nodebb forum app to mongodb.

Upvotes: 0

Views: 1176

Answers (1)

Shashank Agrawal
Shashank Agrawal

Reputation: 25797

db.createUser({user: "username", pwd: "monkey123", roles: [{role: "readWrite", db: "0"}]});

You missed the ().

Upvotes: 2

Related Questions