0
I need to create database and Mongodb user, but all via shell.
I found something about --Eval and --shell, but I couldn’t make it work, I’m trying it that way:
mongo mongodb://11.11.123.321:27017 --eval "db.createUser({user: "teste", pwd: "teste123", roles: [{role: "readWrite", db: "novaBase"}]})"
Of course if I run the initial command give a enter and then run the second will work, but the current scenario I need to do all this "at once", with an ssh lib that connects on the server and runs the command, I do this with mysql already example:
mysql -u root -pteste123 -e "CREATE USER teste@localhost"........