How do i view queries being executed by my mongodb?

后端 未结 2 771
既然无缘
既然无缘 2021-02-06 14:53

I keep on seeing this in my log/development.log, and I am wondering whether this query is actually being executed in my database:

MONGODB (0ms) socialcrunch_deve         


        
相关标签:
2条回答
  • 2021-02-06 14:57

    http://www.mongovue.com/ provides good ui interface to check runtime status of server

    0 讨论(0)
  • 2021-02-06 15:10

    Print all active reads:

    db.currentOp().inprog.forEach(
       function(d){
         if(d.waitingForLock && d.lockType != "read")
            printjson(d)
         })
    

    Print all active writes:

    db.currentOp().inprog.forEach(
       function(d){
         if(d.waitingForLock && d.lockType != "write")
            printjson(d)
         })
    

    You can get a lot more granular if you like by using currentOp.op to filter by a specific operation type (insert, update, delete, etc).

    Check out the following page from MongoDB.org's documentation for more info: http://docs.mongodb.org/manual/reference/current-op/

    0 讨论(0)
提交回复
热议问题