docs: function MongoDB(config) {
    
      var self = this;
      
      this.events = new EventEmitter();
  
      config = protos.extend({
        host: 'localhost',
        port: 27017,
        database: 'default',
        storage: null,
        username: '',
        password: '',
        safe: true
      }, config || {});
      
      if (typeof config.port != 'number') config.port = parseInt(config.port, 10);
      
      this.className = this.constructor.name;
      
      app.debug(util.format('Initializing MongoDB for %s:%s', config.host, config.port));
      
      /**
      
        config: {
          host: 'localhost',
          port: 27017,
          database: 'db_name',
          storage: 'redis'
        }
  
       */
  
      this.config = config;
  
      var reportError = function(err) {
        app.log(util.format("MongoDB [%s:%s] %s", config.host, config.port, err));
        self.client = null;
      }
      
      // Set db
      self.db = new Db(config.database, new Server(config.host, config.port, {}), {safe: config.safe});
      
      // Add async task
      app.addReadyTask();
      
      // Get client
      self.db.open(function(err, client) {
        
        if (err) {
          reportError(err);
        } else {
          
          // Set client
          self.client = client;
          
          // Set storage
          if (typeof config.storage == 'string') {
            self.storage = app.getResource('storages/' + config.storage);
          } else if (config.storage instanceof protos.lib.storage) {
            self.storage = config.storage;
          }
          
          // Authenticate
          if (config.username && config.password) {
            
            self.db.authenticate(config.username, config.password, function(err, success) {
              
              if (err) {
                
                var msg = util.format('MongoDB: unable to authenticate %s@%s', config.username, config.host);
                app.log(new Error(msg));
                throw err;
                
              } else {
                
                // Emit initialization event
                self.events.emit('init', self.db, self.client);
                
              }
              
            });
            
          } else {
            // Emit initialization event
            self.events.emit('init', self.db, self.client);
          }
          
        }
      });
      
      // Flush async task
      this.events.once('init', function() {
        app.flushReadyTask();
      });
  
      // Only set important properties enumerable
      protos.util.onlySetEnumerable(this, ['className', 'db']);
  }