Skip to content

Instantly share code, notes, and snippets.

View imaustink's full-sized avatar

Austin Kurpuis imaustink

View GitHub Profile
@imaustink
imaustink / mongo-connection-url.js
Created March 3, 2016 17:21
Simple Mongo DB connection URL generator in JavaScript
function mongoURL(options) {
options = options || {};
var URL = 'mongodb://';
if (options.password && options.username) URL += options.username + ':' + options.password + '@';
URL += (options.host || 'localhost') + ':';
URL += (options.port || '27017') + '/';
URL += (options.database || 'admin');
return URL;
}