发布于 2015-09-14 14:50:16 | 154 次阅读 | 评论: 0 | 来源: 网络整理
返回: | A document that contains an array named inprog. |
---|
The inprog array reports the current operation in progress for the database instance. See 当前操作报告 for full documentation of the output of db.currentOp().
db.currentOp() is only available for users with administrative privileges.
Consider the following JavaScript operations for the mongo shell that you can use to filter the output of identify specific types of operations:
Return all pending write operations:
db.currentOp().inprog.forEach(
function(d){
if(d.waitingForLock && d.lockType != "read")
printjson(d)
})
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)
})
警告
Terminate running operations with extreme caution. Only use db.killOp() to terminate operations initiated by clients and do not terminate internal database operations.