Get the detail of mongodb Host and mongodb runing on which port fo you get all these type of info from mongo shell.

getHostName(); # Hostname info

db.serverCmdLineOpts(); # Port info
db.serverCmdLineOpts().parsed.net.port

db.runCommand({whatsmyuri : 1}) # Its is showing both Hostname and Port

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.