Get the running opIds of current user

I’m connected to a DB and I don’t have access to the admin db so I can’t run db.currentOp… Is there a way to get all the operations currently running under my username ?

The operations are run from a python script. Is there a way to get the opId of a given cursor (usually aggregate) while running it ?

cursor = db.coll.aggregate([{....}])
opid = cursor.get_opId() ?????
for record in cursor:
    ...

Hi @RemiJ and welcome to the Community

The below command, would give you the desired operations

db.currentOp( { “$ownOps”: true } )

Please see the db.currentOp() documentation for more information.

Also, using the above command, you would be able to see not all but only your own operations.

Let us know if you have any further questions.

Thanks
Aasawari

1 Like