Saturday, January 21, 2017

Script writting/execution of Mongo commands:

Script writting/execution of Mongo commands:




When we execute an operation through the shell or another interface,
we can use db.runCommand()

db.runCommand({command:value,....p1:v1,p2:v2....})

eg:

db.runCommand({getLastError:1})   ---- Last execution error msg

db.runCommand({isMaster:1})   ----Primary or not

db.runCommand({serverStatus:1}) -- Health of the server

No comments:

Post a Comment