Converts a shell connection string (from Atlas) to a MongoDB URL.
var shellToUrl = require('mongodb-shell-to-url');
var connectionString = 'mongo "mongodb://localhost:27017?replicaSet=MyCluster" --ssl --username hans';
console.log(shellToUrl(connectionString));
// logs "mongodb://hans:PASSWORD@localhost:27017?ssl=true&replicaSet=MyCluster&authSource=admin"- requires a MongoDB URI in double-quotes
- does not support
--hostname,--portyet - ignores password and hard-codes to
PASSWORDfor security reasons - only works if the original MongoDB URL contains a
?, sorry :-)
Apache 2.0