index.js
function Storage(mongoURI, mongoOptions, storageOptions) {
  if (!(this instanceof Storage)) {
    return new Storage(mongoURI, mongoOptions, storageOptions);
  }

  assert(typeof mongoOptions === 'object', 'Invalid mongo options supplied');

  this._uri = mongoURI;
  this._options = mongoOptions;

  const defaultLogger = {
    info: console.log,
    debug: console.log,
    error: console.error,
    warn: console.warn
  };
  this._log = defaultLogger;
  if (storageOptions && storageOptions.logger) {
    this._log = storageOptions.logger;
  }

  // connect to the database
  this._connect();
}
function Storage(mongoURI, mongoOptions, storageOptions) {
  if (!(this instanceof Storage)) {
    return new Storage(mongoURI, mongoOptions, storageOptions);
  }

  assert(typeof mongoOptions === 'object', 'Invalid mongo options supplied');

  this._uri = mongoURI;
  this._options = mongoOptions;

  const defaultLogger = {
    info: console.log,
    debug: console.log,
    error: console.error,
    warn: console.warn
  };
  this._log = defaultLogger;
  if (storageOptions && storageOptions.logger) {
    this._log = storageOptions.logger;
  }

  // connect to the database
  this._connect();
}
function Storage ( mongoURI , mongoOptions , storageOptions ) { if ( ! ( this instanceof Storage ) ) { return new Storage ( mongoURI , mongoOptions , storageOptions ) ; } assert ( typeof mongoOptions === 'object' , 'Invalid mongo options supplied' ) ; this . _uri = mongoURI ; this . _options = mongoOptions ; const defaultLogger = { info : console . log , debug : console . log , error : console . error , warn : console . warn } ; this . _log = defaultLogger ; if ( storageOptions && storageOptions . logger ) { this . _log = storageOptions . logger ; } // connect to the database this . _connect ( ) ; }
MongoDB storage interface
@constructor
@param {Object} mongoConf
@param {Object} options
MongoDB storage interface