sudo apt-get install mongodb-server
mkdir -p mongodb/db1
mongod --port 27017 --dbpath /home/pi/mongodb/db1
Connecting to db:
mongo --port 27017
Creating admin user:
use admin
db.addUser(
{
user: "root",
pwd: "abc123",
roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
}
)
use admin
db.grantRolesToUser(
"myUserAdmin",
[ { role: "userAdminAnyDatabase", db: "admin" },
{ role: "dbAdminAnyDatabase", db: "admin" },
{ role: "readWriteAnyDatabase", db: "admin" } ]
)