By Alvin Alexander. Last updated: June 6, 2016
As a quick note, there are probably better ways to do this, but the only way I've found so far to see the number of open MongoDB database connections is to look at it from the Unix/Linux command line, using the lsof command:
$ sudo lsof | grep mongod | grep TCP mongod 5733 Al 6u IPv4 0x08761278 0t0 TCP *:28017 (LISTEN) mongod 5733 Al 7u IPv4 0x07c7eb98 0t0 TCP *:27017 (LISTEN) mongod 5733 Al 9u IPv4 0x08761688 0t0 TCP 192.168.1.103:27017->192.168.1.103:64752 (ESTABLISHED) mongod 5733 Al 12u IPv4 0x08761a98 0t0 TCP 192.168.1.103:27017->192.168.1.103:64754 (ESTABLISHED) mongod 5733 Al 13u IPv4 0x095fa748 0t0 TCP 192.168.1.103:27017->192.168.1.103:64770 (ESTABLISHED) mongod 5733 Al 14u IPv4 0x095f86c8 0t0 TCP 192.168.1.103:27017->192.168.1.103:64775 (ESTABLISHED) mongod 5733 Al 17u IPv4 0x08764748 0t0 TCP 192.168.1.103:27017->192.168.1.103:64777 (ESTABLISHED)
This shows that I currently have five connections open to the MongoDB port (27017) on my computer. In my case I'm connecting to MongoDB from a Scalatra server, and I'm using the MongoDB Casbah driver, but you'll see the same lsof TCP connections regardless of the client used (as long as they're connecting using TCP/IP).