Get the Mongo information for command line programs.
// your-program.js
const cliMongoConnection = require('cli-mongo-connection');
async function main() {
const db = await cliMongoConnection();
// do something with the connection to the database
}
$ node your-program.js --host <host> --port <port> --username <username> --password <password>
I built this to easily connect to a mongo database to run small scripts.
You can only connect to one database.
It just has the host, port, username and password.