-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make getMongoData.js compatible with mongosh #130
base: master
Are you sure you want to change the base?
Conversation
* mongosh doesn't include the native hostname() method anymore * to make getMongoData.js compatible with mongosh check if hostname() method exists * if not, put "N/A"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Orca Security Scan Summary
Status | Check | Issues by priority | |
---|---|---|---|
Passed | Infrastructure as Code | 0 0 0 0 | View in Orca |
Passed | Vulnerabilities | 0 0 0 0 | View in Orca |
Passed | Secrets | 0 0 0 0 | View in Orca |
getMongoData/getMongoData.js
Outdated
@@ -263,7 +263,7 @@ function printInfo(message, command, section, printCapture, commandParameters) { | |||
function printServerInfo() { | |||
section = "server_info"; | |||
printInfo('Shell version', version, section); | |||
printInfo('Shell hostname', hostname, section); | |||
printInfo('Shell hostname', typeof hostname !== "undefined" ? hostname : function(){return "N/A"}, section); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of returning N/A mongosh supports os.hostname()
getMongoData/getMongoData.js
Outdated
@@ -580,7 +580,7 @@ if (! _printJSON) { | |||
print("getMongoData.js version " + _version); | |||
print("================================"); | |||
} | |||
var _host = hostname(); | |||
var _host = typeof hostname !== "undefined" ? hostname() : "N/A"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here we should use os.hostname()
* Use os.hostname instead of "N/A" for shell hostname * Use db.printSecondaryReplicationInfo() instead of db.printSlaveReplicationInfo() if printSlaveReplicationInfo is deprecated
mongosh
doesn't include the native methodhostname()
anymore and deprecated db.printSlaveReplicationInfo()