You can very easily find out the running threads in the database (e.g. like a MySQL SHOW PROCESSLIST) with db.currentOp .
> db.currentOp();
{ "inprog" : [ ] }
No much happening, however under some load you can see
> db.currentOp();
{
"inprog" : [
{
"opid" : 27980,
"active" : true,
"lockType" : "write",
"waitingForLock" : false,
"secs_running" : 0,
"op" : "insert",
"ns" : "olympics.olympic_athlete",
"client" : "127.0.0.1:63652",
"desc" : "conn"
}
]
}
> db.currentOp();
{
"inprog" : [
{
"opid" : 57465,
"active" : true,
"lockType" : "write",
"waitingForLock" : false,
"secs_running" : 0,
"op" : "insert",
"ns" : "olympics.olympic_athlete_affiliation",
"client" : "127.0.0.1:63653",
"desc" : "conn"
}
]
}
I was able to see these when I was Bulk Loading Data
The HTTPConsole at http://localhost:28017/ (for default installation) also shows you all client connections as well as more information per thread, database uptime, replication status and a DBTOP for recent namespaces. For example:
mongodb mactazosx.local:27017
db version v1.4.3, pdfile version 4.5
git hash: 47ffbdfd53f46edeb6ff54bbb734783db7abc8ca
sys info: Darwin broadway.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386 BOOST_LIB_VERSION=1_40
dbwritelocked: 0 (initial)
uptime: 2851 seconds
assertions:
replInfo:
Clients:
Thread OpId Active LockType Waiting SecsRunning Op NameSpace Query client msg progress
initandlisten 0 1 2004 test { name: /^local.temp./ } 0.0.0.0:0
snapshotthread 0 0 0 0.0.0.0:0
websvr 18 -1 2004 test._defaultCollection {} 0.0.0.0:0
conn 83741 -1 2004 olympics.olympic_host_city {} 127.0.0.1:63268
conn 83739 0 2004 ? { getlasterror: 1.0 } 127.0.0.1:63756
time to get dblock: 0ms
# databases: 3
Cursors byLoc.size(): 0
replication
master: 0
slave: 0
initialSyncCompleted: 1
DBTOP (occurences|percent of elapsed)
NS total Reads Writes Queries GetMores Inserts Updates Removes
GLOBAL 1 0.00% 1 0.00% 0 0.00% 1 0.00% 0 0.00% 0 0.00% 0 0.00% 0 0.00%
olympics.olympic_host_city 1 0.00% 1 0.00% 0 0.00% 1 0.00% 0 0.00% 0 0.00% 0 0.00% 0 0.00%
It was interesting to see a whatsmyuri command. Will need to investigate that further.