How do I know that I am connected to a config server I need a simple check for identifying that I am connected to a MongoDB config server.

I can check the process to differentiate between mongod and mongos:

&gt; db.serverStatus().process;
mongod


Now I make an assumption that config server is the one without a replica set name, but it would not always hold true. I check that below returns a NULL value.

&gt; db.serverStatus().repl.setName;


What is a better way to identify config server from mongod in a simple manner? This would be useful for custom prompt function based on the connection.
I found one way to do it.  

On config server:

&gt; db.serverCmdLineOpts().parsed.sharding.clusterRole
configsvr


On shard server:

&gt; db.serverCmdLineOpts().parsed.sharding.clusterRole
shardsvr


Have to be careful as db.serverCmdLineOpts().parsed.sharding.clusterRole is not always defined.