function Database(url, onConnected) {
	var self = this;
	try {
		MongoClient.connect(url, function (err, db) {
			if (err) {
				if (onConnected)
					setImmediate(onConnected, err);
			}
			else {
				self.db = db;
				self.collection = db.collection('StringStore');
				if (onConnected)
					setImmediate(onConnected, null);
			}
		});
	}
	catch (e) {
		console.log(e);
		if (onConnected)
			setImmediate(onConnected, new Error('Failed to connect to database'));
	}
}
/**
 * Store an array of name value pairs. Each pair also gets a timestamp and are arranged into an array
 * @param {String} url URL to the MongoDB Database
 * @param {Function(Error)} onConnected Function to call on success/failure
 */
Store an array of name value pairs. Each pair also gets a timestamp and are arranged into an array
@param {String} url URL to the MongoDB Database
@param {Function(Error)} onConnected Function to call on success/failure
Store an array of name value pairs . Each pair also gets a timestamp and are arranged into an array @param { String } url URL to the MongoDB Database @param { Function ( Error ) } onConnected Function to call on success / failure
function Database(url, onConnected) {
	var self = this;
	try {
		MongoClient.connect(url, function (err, db) {
			if (err) {
				if (onConnected)
					setImmediate(onConnected, err);
			}
			else {
				self.db = db;
				self.collection = db.collection('StringStore');
				if (onConnected)
					setImmediate(onConnected, null);
			}
		});
	}
	catch (e) {
		console.log(e);
		if (onConnected)
			setImmediate(onConnected, new Error('Failed to connect to database'));
	}
}
function Database ( url , onConnected ) { var self = this ; try { MongoClient . connect ( url , function ( err , db ) { if ( err ) { if ( onConnected ) setImmediate ( onConnected , err ) ; } else { self . db = db ; self . collection = db . collection ( 'StringStore' ) ; if ( onConnected ) setImmediate ( onConnected , null ) ; } } ) ; } catch ( e ) { console . log ( e ) ; if ( onConnected ) setImmediate ( onConnected , new Error ( 'Failed to connect to database' ) ) ; } }
Store an array of name value pairs.
Store an array of name value pairs .