db.currentOp() will return a document that reports in-progress operations for the database instance
i.e
db.currentOp(true)
This will return a more descriptive output, including idle connections and system operations.
Note: db.currentOp() is available only for Administrative users
To get current users;
db.currentOp().inprog.forEach(
function(d){
if(d.client)
printjson(d.client)
})
Shards Environment
db.currentOp().inprog.forEach(
function(d){
if(d.client_s)
printjson(d.client_s)
})
Return the active write operation
db.currentOp().inprog.forEach(
function(d){
if(d.active && d.lockType == "write")
printjson(d)
})
Return all active read operations
db.currentOp().inprog.forEach(
function(d){
if(d.active && d.lockType == "read")
printjson(d)
})
Source Link : http://docs.mongodb.org/manual/reference/method/db.currentOp/
No comments:
Post a Comment