Skip to content

Instantly share code, notes, and snippets.

@geek182
Last active November 14, 2017 20:40
Show Gist options
  • Save geek182/659ec1401a4b5cbbf91848f559d1d509 to your computer and use it in GitHub Desktop.
Save geek182/659ec1401a4b5cbbf91848f559d1d509 to your computer and use it in GitHub Desktop.
# CREATE USER ADD ROLE
use mydb
db.createUser(
{
user: "accountUser",
pwd: "password",
roles: [ "readWrite", "dbAdmin" ]
}
)
#show dbs
show dbs
#extend info for monitoring
db.serverStatus()
#specif info for monitoring
db.serverStatus().uptime
#Get loglevel
#The verbosity level can range from 0 to 5:
#0 is the MongoDB’s default log verbosity level, to include Informational messages.
#1 to 5 increases the verbosity level to include Debug messages.
# -1 to inherit the verbosity of the parent.
db.getLogComponents()
#set loglevel
db.setLogLevel(-1, "query")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment