User Connections

Hi,

MongoDB version 4.4.14
I’ve been trying to find all current active users.
I located the effectiveUsers when running db.currentOp() but when I run db.currentOp().effectiveUsers I get nothing. What am I doing wrong here?
Thanks!

Hello @Shalom_Sagges,

effectiveUsers is a nested field, so try this -

db.currentOp().inprog.forEach((op) => {if(op.effectiveUsers) {op.effectiveUsers.forEach(eUser => print(eUser.user))}} );

Additionally, if you like to see idle connections and system operations, pass in argument true to currentOp

Hope this helps.

Thanks,
Mahi

1 Like

Amazing!
This most definitely helps.
Thanks a lot @Mahi_Satyanarayana :slight_smile: