Skip to content

Latest commit

 

History

History
40 lines (32 loc) · 921 Bytes

example-filter-current-op.rst

File metadata and controls

40 lines (32 loc) · 921 Bytes
  • Return all write operations waiting for a lock:

    db.currentOp(
       {
         "waitingForLock" : true,
         $or: [
            { "op" : { "$in" : [ "insert", "update", "remove" ] } },
            { "query.update": { $exists: true } },
            { "query.insert": { $exists: true } },
            { "query.remove": { $exists: true } }
         ]
       }
    )
  • Return all active running operations that have never yielded:

    db.currentOp(
       {
         "active" : true,
         "numYields" : 0,
         "waitingForLock" : false
       }
    )
  • Return all active queries for database db1 that have been running longer than 3 seconds:

    db.currentOp(
       {
         "active" : true,
         "secs_running" : { "$gt" : 3 },
         "ns" : /^db1./
       }
    )