MongoDB has a currentOp command that contains current operations (in general, not just open cursors). The result is an array of "inprog" values. You have a workflow identifier, not a cursor identifier, but it is very useful to investigate heavy operations or those that work for a long time. This is not exactly what you want, but I think you could write a small program that analyzes the execution time of operations to determine which one has been running for a certain period of time.
Look at the example of my aggregation database, which I run only for testing purposes, I will hide some data, because it is very reasonable in our case :)
"inprog" : [ { "opid" : 74074645, "active" : true, "secs_running" : 2, "op" : "query", "ns" : "mydb.Terms.ByHour", "query" : { "aggregate" : "Terms.ByHour", "pipeline" : [ { "$match" : { "cluster" : "my_key", "start" : { "$gte" : ISODate("2013-11-10T00:00:00Z"), "$lte" : ISODate("2013-11-11T00:00:00Z") } } }, { "$group" : { "_id" : "$start", "count" : { "$sum" : "$count" } } }, { "$sort" : { "_id" : 1 } } ]
Just put the result in a variable:
currentOps = db.currentOp()
and use it like regular json, or write a small program that iterates over the currentOps.inprog array and checks for secs_running> something
Hope this helps.
source share