发布于 2015-09-14 14:50:16 | 154 次阅读 | 评论: 0 | 来源: 网络整理

db.currentOp()
返回: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.

最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务