Nerdier

Adjective: Comparative form of nerdy: more nerdy.

MongoDB notes

Some notes on MongoDB

Create User

db.createUser(
  {
    user: "admin",
    pwd: "hunter2",
    roles: [ { role: "root", db: "admin" } ]
  }
);

Authenticate as admin to do stuff

use admin
db.auth('admin','hunter2')

Add user for db

db.createUser({ user: "db1user", pwd: "hunter3", roles: [{ role: "readWrite", db: "db1" }] })

Add server to replication set

rs.add("server1.serverhostna.me")

Add a server replication set as a non voting member.

rs.add({ "host":"server2.serverhostna.me", "votes": 0, "priority":0 })

Leave a Reply

Your email address will not be published. Required fields are marked *