MongoDB में कनेक्टेड क्लाइंट प्राप्त करने के लिए, currentOp() का उपयोग सेट मान के साथ true पर करें और आपको फ़ील्ड क्लाइंट की सहायता से सरणी परिणाम सेट को पुनरावृत्त करने की आवश्यकता है। आइए पहले करंटऑप को लागू करें
> db.currentOp(true)
निम्नलिखित आउटपुट है। यहां क्लाइंट 127.0.0.1 है क्योंकि हम लोकलहोस्ट का उपयोग कर रहे हैं। आउटपुट सभी कनेक्टेड क्लाइंट को प्रदर्शित करता है
{ "inprog" : [ { "host" : "DESKTOP-QN2RB3H:27017", "desc" : "conn1", "connectionId" : 1, "client" : "127.0.0.1:61787", "appName" : "MongoDB Shell", "clientMetadata" : { "application" : { "name" : "MongoDB Shell" }, "driver" : { "name" : "MongoDB Internal Client", "version" : "4.0.5" }, "os" : { "type" : "Windows", "name" : "Microsoft Windows 10", "architecture" : "x86_64", "version" : "10.0 (build 17134)" } }, "active" : true, "currentOpTime" : "2019-03-30T05:13:34.296+0530", "opid" : 12538, "lsid" : { "id" : UUID("da370b0f-093a-45f3-b1fe-697daca8ccd2"), "uid" : BinData(0,"47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=") }, "secs_running" : NumberLong(0), "microsecs_running" : NumberLong(160815), "op" : "command", "ns" : "admin.$cmd.aggregate", "command" : { "currentOp" : 1, "$all" : true, "lsid" : { "id" : UUID("da370b0f-093a-45f3-b1fe-697daca8ccd2") }, "$db" : "admin" }, "numYields" : 0, "locks" : { }, "waitingForLock" : false, "lockStats" : { } }, { "host" : "DESKTOP-QN2RB3H:27017", "desc" : "LogicalSessionCacheRefresh", "active" : false, "currentOpTime" : "2019-03-30T05:13:34.296+0530" }, { "host" : "DESKTOP-QN2RB3H:27017", "desc" : "SessionKiller", "active" : false, "currentOpTime" : "2019-03-30T05:13:34.296+0530" }, { "host" : "DESKTOP-QN2RB3H:27017", "desc" : "TTLMonitor", "active" : false, "currentOpTime" : "2019-03-30T05:13:34.296+0530" }, { "host" : "DESKTOP-QN2RB3H:27017", "desc" : "free_mon", "active" : false, "currentOpTime" : "2019-03-30T05:13:34.296+0530" }, { "host" : "DESKTOP-QN2RB3H:27017", "desc" : "freemon-0", "active" : false, "currentOpTime" : "2019-03-30T05:13:34.296+0530" }, { "host" : "DESKTOP-QN2RB3H:27017", "desc" : "startPeriodicThreadToAbortExpiredTransactions", "active" : false, "currentOpTime" : "2019-03-30T05:13:34.296+0530" }, { "host" : "DESKTOP-QN2RB3H:27017", "desc" : "WTCheckpointThread", "active" : false, "currentOpTime" : "2019-03-30T05:13:34.296+0530" }, { "host" : "DESKTOP-QN2RB3H:27017", "desc" : "ftdc", "active" : false, "currentOpTime" : "2019-03-30T05:13:34.296+0530" }, { "host" : "DESKTOP-QN2RB3H:27017", "desc" : "WTJournalFlusher", "active" : false, "currentOpTime" : "2019-03-30T05:13:34.296+0530" }, { "host" : "DESKTOP-QN2RB3H:27017", "desc" : "clientcursormon", "active" : false, "currentOpTime" : "2019-03-30T05:13:34.296+0530" }, { "host" : "DESKTOP-QN2RB3H:27017", "desc" : "initandlisten", "active" : false, "currentOpTime" : "2019-03-30T05:13:34.296+0530" } ], "ok" : 1 }