How do I know that I am connected to a config server
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.