You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ga...@apache.org on 2015/11/30 10:37:14 UTC

[32/51] [abbrv] [partial] couchdb-nmo git commit: Remove node_modules from repo

http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/6436833c/node_modules/couchbulkimporter/node_modules/mongodb/lib/mongos.js
----------------------------------------------------------------------
diff --git a/node_modules/couchbulkimporter/node_modules/mongodb/lib/mongos.js b/node_modules/couchbulkimporter/node_modules/mongodb/lib/mongos.js
deleted file mode 100644
index 6087d76..0000000
--- a/node_modules/couchbulkimporter/node_modules/mongodb/lib/mongos.js
+++ /dev/null
@@ -1,491 +0,0 @@
-"use strict";
-
-var EventEmitter = require('events').EventEmitter
-  , inherits = require('util').inherits
-  , f = require('util').format
-  , ServerCapabilities = require('./topology_base').ServerCapabilities
-  , MongoCR = require('mongodb-core').MongoCR
-  , CMongos = require('mongodb-core').Mongos
-  , Cursor = require('./cursor')
-  , AggregationCursor = require('./aggregation_cursor')
-  , CommandCursor = require('./command_cursor')
-  , Define = require('./metadata')
-  , Server = require('./server')
-  , Store = require('./topology_base').Store
-  , shallowClone = require('./utils').shallowClone;
-
-/**
- * @fileOverview The **Mongos** class is a class that represents a Mongos Proxy topology and is
- * used to construct connections.
- *
- * **Mongos Should not be used, use MongoClient.connect**
- * @example
- * var Db = require('mongodb').Db,
- *   Mongos = require('mongodb').Mongos,
- *   Server = require('mongodb').Server,
- *   test = require('assert');
- * // Connect using Mongos
- * var server = new Server('localhost', 27017);
- * var db = new Db('test', new Mongos([server]));
- * db.open(function(err, db) {
- *   // Get an additional db
- *   db.close();
- * });
- */
-
-/**
- * Creates a new Mongos instance
- * @class
- * @deprecated
- * @param {Server[]} servers A seedlist of servers participating in the replicaset.
- * @param {object} [options=null] Optional settings.
- * @param {booelan} [options.ha=true] Turn on high availability monitoring.
- * @param {number} [options.haInterval=5000] Time between each replicaset status check.
- * @param {number} [options.poolSize=5] Number of connections in the connection pool for each server instance, set to 5 as default for legacy reasons.
- * @param {boolean} [options.ssl=false] Use ssl connection (needs to have a mongod server with ssl support)
- * @param {object} [options.sslValidate=true] Validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher)
- * @param {array} [options.sslCA=null] Array of valid certificates either as Buffers or Strings (needs to have a mongod server with ssl support, 2.4 or higher)
- * @param {(Buffer|string)} [options.sslCert=null] String or buffer containing the certificate we wish to present (needs to have a mongod server with ssl support, 2.4 or higher)
- * @param {(Buffer|string)} [options.sslKey=null] String or buffer containing the certificate private key we wish to present (needs to have a mongod server with ssl support, 2.4 or higher)
- * @param {(Buffer|string)} [options.sslPass=null] String or buffer containing the certificate password (needs to have a mongod server with ssl support, 2.4 or higher)
- * @param {object} [options.socketOptions=null] Socket options
- * @param {boolean} [options.socketOptions.noDelay=true] TCP Socket NoDelay option.
- * @param {number} [options.socketOptions.keepAlive=0] TCP KeepAlive on the socket with a X ms delay before start.
- * @param {number} [options.socketOptions.connectTimeoutMS=0] TCP Connection timeout setting
- * @param {number} [options.socketOptions.socketTimeoutMS=0] TCP Socket timeout setting
- * @fires Mongos#connect
- * @fires Mongos#ha
- * @fires Mongos#joined
- * @fires Mongos#left
- * @fires Mongos#fullsetup
- * @fires Mongos#open
- * @fires Mongos#close
- * @fires Mongos#error
- * @fires Mongos#timeout
- * @fires Mongos#parseError
- * @return {Mongos} a Mongos instance.
- */
-var Mongos = function(servers, options) {
-  if(!(this instanceof Mongos)) return new Mongos(servers, options);
-  options = options || {};
-  var self = this;
-
-  // Ensure all the instances are Server
-  for(var i = 0; i < servers.length; i++) {
-    if(!(servers[i] instanceof Server)) {
-      throw MongoError.create({message: "all seed list instances must be of the Server type", driver:true});
-    }
-  }
-
-  // Store option defaults
-  var storeOptions = {
-      force: false
-    , bufferMaxEntries: -1
-  }
-
-  // Shared global store
-  var store = options.store || new Store(self, storeOptions);
-
-  // Set up event emitter
-  EventEmitter.call(this);
-
-  // Debug tag
-  var tag = options.tag;
-
-  // Build seed list
-  var seedlist = servers.map(function(x) {
-    return {host: x.host, port: x.port}
-  });
-
-  // Final options
-  var finalOptions = shallowClone(options);
-
-  // Default values
-  finalOptions.size = typeof options.poolSize == 'number' ? options.poolSize : 5;
-  finalOptions.reconnect = typeof options.auto_reconnect == 'boolean' ? options.auto_reconnect : true;
-  finalOptions.emitError = typeof options.emitError == 'boolean' ? options.emitError : true;
-  finalOptions.cursorFactory = Cursor;
-
-  // Add the store
-  finalOptions.disconnectHandler = store;
-
-  // Ensure we change the sslCA option to ca if available
-  if(options.sslCA) finalOptions.ca = options.sslCA;
-  if(typeof options.sslValidate == 'boolean') finalOptions.rejectUnauthorized = options.sslValidate;
-  if(options.sslKey) finalOptions.key = options.sslKey;
-  if(options.sslCert) finalOptions.cert = options.sslCert;
-  if(options.sslPass) finalOptions.passphrase = options.sslPass;
-
-  // Socket options passed down
-  if(options.socketOptions) {
-    if(options.socketOptions.connectTimeoutMS) {
-      this.connectTimeoutMS = options.socketOptions.connectTimeoutMS;
-      finalOptions.connectionTimeout = options.socketOptions.connectTimeoutMS;
-    }
-    if(options.socketOptions.socketTimeoutMS)
-      finalOptions.socketTimeout = options.socketOptions.socketTimeoutMS;
-  }
-
-  // Are we running in debug mode
-  var debug = typeof options.debug == 'boolean' ? options.debug : false;
-  if(debug) {
-    finalOptions.debug = debug;
-  }
-
-  // Map keep alive setting
-  if(options.socketOptions && typeof options.socketOptions.keepAlive == 'number') {
-    finalOptions.keepAlive = true;
-    if(typeof options.socketOptions.keepAlive == 'number') {
-      finalOptions.keepAliveInitialDelay = options.socketOptions.keepAlive;
-    }
-  }
-
-  // Connection timeout
-  if(options.socketOptions && typeof options.socketOptions.connectionTimeout == 'number') {
-    finalOptions.connectionTimeout = options.socketOptions.connectionTimeout;
-  }
-
-  // Socket timeout
-  if(options.socketOptions && typeof options.socketOptions.socketTimeout == 'number') {
-    finalOptions.socketTimeout = options.socketOptions.socketTimeout;
-  }
-
-  // noDelay
-  if(options.socketOptions && typeof options.socketOptions.noDelay == 'boolean') {
-    finalOptions.noDelay = options.socketOptions.noDelay;
-  }
-
-  if(typeof options.secondaryAcceptableLatencyMS == 'number') {
-    finalOptions.acceptableLatency = options.secondaryAcceptableLatencyMS;
-  }
-
-  // Add the non connection store
-  finalOptions.disconnectHandler = store;
-
-  // Create the Mongos
-  var mongos = new CMongos(seedlist, finalOptions)
-  // Server capabilities
-  var sCapabilities = null;
-  // Add auth prbufferMaxEntriesoviders
-  mongos.addAuthProvider('mongocr', new MongoCR());
-
-  // Internal state
-  this.s = {
-    // Create the Mongos
-      mongos: mongos
-    // Server capabilities
-    , sCapabilities: sCapabilities
-    // Debug turned on
-    , debug: debug
-    // Store option defaults
-    , storeOptions: storeOptions
-    // Cloned options
-    , clonedOptions: finalOptions
-    // Actual store of callbacks
-    , store: store
-    // Options
-    , options: options
-  }
-
-
-  // Last ismaster
-  Object.defineProperty(this, 'isMasterDoc', {
-    enumerable:true, get: function() { return self.s.mongos.lastIsMaster(); }
-  });
-
-  // Last ismaster
-  Object.defineProperty(this, 'numberOfConnectedServers', {
-    enumerable:true, get: function() { 
-      return self.s.mongos.s.mongosState.connectedServers().length; 
-    }
-  });
-
-  // BSON property
-  Object.defineProperty(this, 'bson', {
-    enumerable: true, get: function() {
-      return self.s.mongos.bson;
-    }
-  });
-
-  Object.defineProperty(this, 'haInterval', {
-    enumerable:true, get: function() { return self.s.mongos.haInterval; }
-  });
-}
-
-/**
- * @ignore
- */
-inherits(Mongos, EventEmitter);
-
-var define = Mongos.define = new Define('Mongos', Mongos, false);
-
-// Connect
-Mongos.prototype.connect = function(db, _options, callback) {
-  var self = this;
-  if('function' === typeof _options) callback = _options, _options = {};
-  if(_options == null) _options = {};
-  if(!('function' === typeof callback)) callback = null;
-  self.s.options = _options;
-
-  // Update bufferMaxEntries
-  self.s.storeOptions.bufferMaxEntries = db.bufferMaxEntries;
-
-  // Error handler
-  var connectErrorHandler = function(event) {
-    return function(err) {
-      // Remove all event handlers
-      var events = ['timeout', 'error', 'close'];
-      events.forEach(function(e) {
-        self.removeListener(e, connectErrorHandler);
-      });
-
-      self.s.mongos.removeListener('connect', connectErrorHandler);
-
-      // Try to callback
-      try {
-        callback(err);
-      } catch(err) {
-        process.nextTick(function() { throw err; })
-      }
-    }
-  }
-
-  // Actual handler
-  var errorHandler = function(event) {
-    return function(err) {
-      if(event != 'error') {
-        self.emit(event, err);
-      }
-    }
-  }
-
-  // Error handler
-  var reconnectHandler = function(err) {
-    self.emit('reconnect');
-    self.s.store.execute();
-  }
-
-  // Connect handler
-  var connectHandler = function() {
-    // Clear out all the current handlers left over
-    ["timeout", "error", "close"].forEach(function(e) {
-      self.s.mongos.removeAllListeners(e);
-    });
-
-    // Set up listeners
-    self.s.mongos.once('timeout', errorHandler('timeout'));
-    self.s.mongos.once('error', errorHandler('error'));
-    self.s.mongos.once('close', errorHandler('close'));
-
-    // relay the event
-    var relay = function(event) {
-      return function(t, server) {
-        self.emit(event, t, server);
-      }
-    }
-
-    // Set up serverConfig listeners
-    self.s.mongos.on('joined', relay('joined'));
-    self.s.mongos.on('left', relay('left'));
-    self.s.mongos.on('fullsetup', relay('fullsetup'));
-
-    // Emit open event
-    self.emit('open', null, self);
-
-    // Return correctly
-    try {
-      callback(null, self);
-    } catch(err) {
-      process.nextTick(function() { throw err; })
-    }
-  }
-
-  // Set up listeners
-  self.s.mongos.once('timeout', connectErrorHandler('timeout'));
-  self.s.mongos.once('error', connectErrorHandler('error'));
-  self.s.mongos.once('close', connectErrorHandler('close'));
-  self.s.mongos.once('connect', connectHandler);
-  // Reconnect server
-  self.s.mongos.on('reconnect', reconnectHandler);
-
-  // Start connection
-  self.s.mongos.connect(_options);
-}
-
-Mongos.prototype.parserType = function() {
-  return this.s.mongos.parserType();
-}
-
-define.classMethod('parserType', {callback: false, promise:false, returns: [String]});
-
-// Server capabilities
-Mongos.prototype.capabilities = function() {
-  if(this.s.sCapabilities) return this.s.sCapabilities;
-  if(this.s.mongos.lastIsMaster() == null) throw MongoError.create({message: 'cannot establish topology capabilities as driver is still in process of connecting', driver:true});
-  this.s.sCapabilities = new ServerCapabilities(this.s.mongos.lastIsMaster());
-  return this.s.sCapabilities;
-}
-
-define.classMethod('capabilities', {callback: false, promise:false, returns: [ServerCapabilities]});
-
-// Command
-Mongos.prototype.command = function(ns, cmd, options, callback) {
-  this.s.mongos.command(ns, cmd, options, callback);
-}
-
-define.classMethod('command', {callback: true, promise:false});
-
-// Insert
-Mongos.prototype.insert = function(ns, ops, options, callback) {
-  this.s.mongos.insert(ns, ops, options, function(e, m) {
-    callback(e, m)
-  });
-}
-
-define.classMethod('insert', {callback: true, promise:false});
-
-// Update
-Mongos.prototype.update = function(ns, ops, options, callback) {
-  this.s.mongos.update(ns, ops, options, callback);
-}
-
-define.classMethod('update', {callback: true, promise:false});
-
-// Remove
-Mongos.prototype.remove = function(ns, ops, options, callback) {
-  this.s.mongos.remove(ns, ops, options, callback);
-}
-
-define.classMethod('remove', {callback: true, promise:false});
-
-// IsConnected
-Mongos.prototype.isConnected = function() {
-  return this.s.mongos.isConnected();
-}
-
-define.classMethod('isConnected', {callback: false, promise:false, returns: [Boolean]});
-
-// Insert
-Mongos.prototype.cursor = function(ns, cmd, options) {
-  options.disconnectHandler = this.s.store;
-  return this.s.mongos.cursor(ns, cmd, options);
-}
-
-define.classMethod('cursor', {callback: false, promise:false, returns: [Cursor, AggregationCursor, CommandCursor]});
-
-Mongos.prototype.setBSONParserType = function(type) {
-  return this.s.mongos.setBSONParserType(type);
-}
-
-Mongos.prototype.lastIsMaster = function() {
-  return this.s.mongos.lastIsMaster();
-}
-
-Mongos.prototype.close = function(forceClosed) {
-  this.s.mongos.destroy();
-  // We need to wash out all stored processes
-  if(forceClosed == true) {
-    this.s.storeOptions.force = forceClosed;
-    this.s.store.flush();
-  }
-}
-
-define.classMethod('close', {callback: false, promise:false});
-
-Mongos.prototype.auth = function() {
-  var args = Array.prototype.slice.call(arguments, 0);
-  this.s.mongos.auth.apply(this.s.mongos, args);
-}
-
-define.classMethod('auth', {callback: true, promise:false});
-
-/**
- * All raw connections
- * @method
- * @return {array}
- */
-Mongos.prototype.connections = function() {
-  return this.s.mongos.connections();
-}
-
-define.classMethod('connections', {callback: false, promise:false, returns:[Array]});
-
-/**
- * A mongos connect event, used to verify that the connection is up and running
- *
- * @event Mongos#connect
- * @type {Mongos}
- */
-
-/**
- * The mongos high availability event
- *
- * @event Mongos#ha
- * @type {function}
- * @param {string} type The stage in the high availability event (start|end)
- * @param {boolean} data.norepeat This is a repeating high availability process or a single execution only
- * @param {number} data.id The id for this high availability request
- * @param {object} data.state An object containing the information about the current replicaset
- */
-
-/**
- * A server member left the mongos set
- *
- * @event Mongos#left
- * @type {function}
- * @param {string} type The type of member that left (primary|secondary|arbiter)
- * @param {Server} server The server object that left
- */
-
-/**
- * A server member joined the mongos set
- *
- * @event Mongos#joined
- * @type {function}
- * @param {string} type The type of member that joined (primary|secondary|arbiter)
- * @param {Server} server The server object that joined
- */
-
-/**
- * Mongos fullsetup event, emitted when all proxies in the topology have been connected to.
- *
- * @event Mongos#fullsetup
- * @type {Mongos}
- */
-
-/**
- * Mongos open event, emitted when mongos can start processing commands.
- *
- * @event Mongos#open
- * @type {Mongos}
- */
-
-/**
- * Mongos close event
- *
- * @event Mongos#close
- * @type {object}
- */
-
-/**
- * Mongos error event, emitted if there is an error listener.
- *
- * @event Mongos#error
- * @type {MongoError}
- */
-
-/**
- * Mongos timeout event
- *
- * @event Mongos#timeout
- * @type {object}
- */
-
-/**
- * Mongos parseError event
- *
- * @event Mongos#parseError
- * @type {object}
- */
-
-module.exports = Mongos;

http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/6436833c/node_modules/couchbulkimporter/node_modules/mongodb/lib/read_preference.js
----------------------------------------------------------------------
diff --git a/node_modules/couchbulkimporter/node_modules/mongodb/lib/read_preference.js b/node_modules/couchbulkimporter/node_modules/mongodb/lib/read_preference.js
deleted file mode 100644
index 73b253a..0000000
--- a/node_modules/couchbulkimporter/node_modules/mongodb/lib/read_preference.js
+++ /dev/null
@@ -1,104 +0,0 @@
-"use strict";
-
-/**
- * @fileOverview The **ReadPreference** class is a class that represents a MongoDB ReadPreference and is
- * used to construct connections.
- * 
- * @example
- * var Db = require('mongodb').Db,
- *   ReplSet = require('mongodb').ReplSet,
- *   Server = require('mongodb').Server,
- *   ReadPreference = require('mongodb').ReadPreference,
- *   test = require('assert');
- * // Connect using ReplSet
- * var server = new Server('localhost', 27017);
- * var db = new Db('test', new ReplSet([server]));
- * db.open(function(err, db) {
- *   test.equal(null, err);
- *   // Perform a read
- *   var cursor = db.collection('t').find({});
- *   cursor.setReadPreference(ReadPreference.PRIMARY);
- *   cursor.toArray(function(err, docs) {
- *     test.equal(null, err);
- *     db.close();
- *   });
- * });
- */
-
-/**
- * Creates a new ReadPreference instance
- * 
- * Read Preferences
- *  - **ReadPreference.PRIMARY**, Read from primary only. All operations produce an error (throw an exception where applicable) if primary is unavailable. Cannot be combined with tags (This is the default.).
- *  - **ReadPreference.PRIMARY_PREFERRED**, Read from primary if available, otherwise a secondary.
- *  - **ReadPreference.SECONDARY**, Read from secondary if available, otherwise error.
- *  - **ReadPreference.SECONDARY_PREFERRED**, Read from a secondary if available, otherwise read from the primary.
- *  - **ReadPreference.NEAREST**, All modes read from among the nearest candidates, but unlike other modes, NEAREST will include both the primary and all secondaries in the random selection.
- *
- * @class
- * @param {string} mode The ReadPreference mode as listed above.
- * @param {object} tags An object representing read preference tags.
- * @property {string} mode The ReadPreference mode.
- * @property {object} tags The ReadPreference tags.
- * @return {ReadPreference} a ReadPreference instance.
- */ 
-var ReadPreference = function(mode, tags) {
-  if(!(this instanceof ReadPreference))
-    return new ReadPreference(mode, tags);
-  this._type = 'ReadPreference';
-  this.mode = mode;
-  this.tags = tags;
-}
-
-/**
- * Validate if a mode is legal
- *
- * @method
- * @param {string} mode The string representing the read preference mode.
- * @return {boolean}
- */  
-ReadPreference.isValid = function(_mode) {
-  return (_mode == ReadPreference.PRIMARY || _mode == ReadPreference.PRIMARY_PREFERRED
-    || _mode == ReadPreference.SECONDARY || _mode == ReadPreference.SECONDARY_PREFERRED
-    || _mode == ReadPreference.NEAREST
-    || _mode == true || _mode == false || _mode == null);
-}
-
-/**
- * Validate if a mode is legal
- *
- * @method
- * @param {string} mode The string representing the read preference mode.
- * @return {boolean}
- */  
-ReadPreference.prototype.isValid = function(mode) {
-  var _mode = typeof mode == 'string' ? mode : this.mode;
-  return ReadPreference.isValid(_mode);
-}
-
-/**
- * @ignore
- */
-ReadPreference.prototype.toObject = function() {
-  var object = {mode:this.mode};
-
-  if(this.tags != null) {
-    object['tags'] = this.tags;
-  }
-
-  return object;
-}
-
-/**
- * @ignore
- */
-ReadPreference.PRIMARY = 'primary';
-ReadPreference.PRIMARY_PREFERRED = 'primaryPreferred';
-ReadPreference.SECONDARY = 'secondary';
-ReadPreference.SECONDARY_PREFERRED = 'secondaryPreferred';
-ReadPreference.NEAREST = 'nearest'
-
-/**
- * @ignore
- */
-module.exports = ReadPreference;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/6436833c/node_modules/couchbulkimporter/node_modules/mongodb/lib/replset.js
----------------------------------------------------------------------
diff --git a/node_modules/couchbulkimporter/node_modules/mongodb/lib/replset.js b/node_modules/couchbulkimporter/node_modules/mongodb/lib/replset.js
deleted file mode 100644
index 8a71b42..0000000
--- a/node_modules/couchbulkimporter/node_modules/mongodb/lib/replset.js
+++ /dev/null
@@ -1,555 +0,0 @@
-"use strict";
-
-var EventEmitter = require('events').EventEmitter
-  , inherits = require('util').inherits
-  , f = require('util').format
-  , Server = require('./server')
-  , Mongos = require('./mongos')
-  , Cursor = require('./cursor')
-  , AggregationCursor = require('./aggregation_cursor')
-  , CommandCursor = require('./command_cursor')
-  , ReadPreference = require('./read_preference')
-  , MongoCR = require('mongodb-core').MongoCR
-  , MongoError = require('mongodb-core').MongoError
-  , ServerCapabilities = require('./topology_base').ServerCapabilities
-  , Store = require('./topology_base').Store
-  , Define = require('./metadata')
-  , CServer = require('mongodb-core').Server
-  , CReplSet = require('mongodb-core').ReplSet
-  , CoreReadPreference = require('mongodb-core').ReadPreference
-  , shallowClone = require('./utils').shallowClone;
-
-/**
- * @fileOverview The **ReplSet** class is a class that represents a Replicaset topology and is
- * used to construct connections.
- *
- * **ReplSet Should not be used, use MongoClient.connect**
- * @example
- * var Db = require('mongodb').Db,
- *   ReplSet = require('mongodb').ReplSet,
- *   Server = require('mongodb').Server,
- *   test = require('assert');
- * // Connect using ReplSet
- * var server = new Server('localhost', 27017);
- * var db = new Db('test', new ReplSet([server]));
- * db.open(function(err, db) {
- *   // Get an additional db
- *   db.close();
- * });
- */
-
-/**
- * Creates a new ReplSet instance
- * @class
- * @deprecated
- * @param {Server[]} servers A seedlist of servers participating in the replicaset.
- * @param {object} [options=null] Optional settings.
- * @param {booelan} [options.ha=true] Turn on high availability monitoring.
- * @param {number} [options.haInterval=5000] Time between each replicaset status check.
- * @param {string} options.replicaSet The name of the replicaset to connect to.
- * @param {number} [options.secondaryAcceptableLatencyMS=15] Sets the range of servers to pick when using NEAREST (lowest ping ms + the latency fence, ex: range of 1 to (1 + 15) ms)
- * @param {boolean} [options.connectWithNoPrimary=false] Sets if the driver should connect even if no primary is available
- * @param {number} [options.poolSize=5] Number of connections in the connection pool for each server instance, set to 5 as default for legacy reasons.
- * @param {boolean} [options.ssl=false] Use ssl connection (needs to have a mongod server with ssl support)
- * @param {object} [options.sslValidate=true] Validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher)
- * @param {array} [options.sslCA=null] Array of valid certificates either as Buffers or Strings (needs to have a mongod server with ssl support, 2.4 or higher)
- * @param {(Buffer|string)} [options.sslCert=null] String or buffer containing the certificate we wish to present (needs to have a mongod server with ssl support, 2.4 or higher)
- * @param {(Buffer|string)} [options.sslKey=null] String or buffer containing the certificate private key we wish to present (needs to have a mongod server with ssl support, 2.4 or higher)
- * @param {(Buffer|string)} [options.sslPass=null] String or buffer containing the certificate password (needs to have a mongod server with ssl support, 2.4 or higher)
- * @param {object} [options.socketOptions=null] Socket options
- * @param {boolean} [options.socketOptions.noDelay=true] TCP Socket NoDelay option.
- * @param {number} [options.socketOptions.keepAlive=0] TCP KeepAlive on the socket with a X ms delay before start.
- * @param {number} [options.socketOptions.connectTimeoutMS=0] TCP Connection timeout setting
- * @param {number} [options.socketOptions.socketTimeoutMS=0] TCP Socket timeout setting
- * @fires ReplSet#connect
- * @fires ReplSet#ha
- * @fires ReplSet#joined
- * @fires ReplSet#left
- * @fires ReplSet#fullsetup
- * @fires ReplSet#open
- * @fires ReplSet#close
- * @fires ReplSet#error
- * @fires ReplSet#timeout
- * @fires ReplSet#parseError
- * @return {ReplSet} a ReplSet instance.
- */
-var ReplSet = function(servers, options) {
-  if(!(this instanceof ReplSet)) return new ReplSet(servers, options);
-  options = options || {};
-  var self = this;
-
-  // Ensure all the instances are Server
-  for(var i = 0; i < servers.length; i++) {
-    if(!(servers[i] instanceof Server)) {
-      throw MongoError.create({message: "all seed list instances must be of the Server type", driver:true});
-    }
-  }
-
-  // Store option defaults
-  var storeOptions = {
-      force: false
-    , bufferMaxEntries: -1
-  }
-
-  // Shared global store
-  var store = options.store || new Store(self, storeOptions);
-
-  // Set up event emitter
-  EventEmitter.call(this);
-
-  // Debug tag
-  var tag = options.tag;
-
-  // Build seed list
-  var seedlist = servers.map(function(x) {
-    return {host: x.host, port: x.port}
-  });
-
-  // Final options
-  var finalOptions = shallowClone(options);
-
-  // Default values
-  finalOptions.size = typeof options.poolSize == 'number' ? options.poolSize : 5;
-  finalOptions.reconnect = typeof options.auto_reconnect == 'boolean' ? options.auto_reconnect : true;
-  finalOptions.emitError = typeof options.emitError == 'boolean' ? options.emitError : true;
-  finalOptions.cursorFactory = Cursor;
-
-  // Add the store
-  finalOptions.disconnectHandler = store;
-
-  // Socket options passed down
-  if(options.socketOptions) {
-    if(options.socketOptions.connectTimeoutMS) {
-      this.connectTimeoutMS = options.socketOptions.connectTimeoutMS;
-      finalOptions.connectionTimeout = options.socketOptions.connectTimeoutMS;
-    }
-
-    if(options.socketOptions.socketTimeoutMS) {
-      finalOptions.socketTimeout = options.socketOptions.socketTimeoutMS;
-    }
-  }
-
-  // Get the name
-  var replicaSet = options.replicaSet || options.rs_name;
-
-  // Set up options
-  finalOptions.setName = replicaSet;
-
-  // Are we running in debug mode
-  var debug = typeof options.debug == 'boolean' ? options.debug : false;
-  if(debug) {
-    finalOptions.debug = debug;
-  }
-
-  // Map keep alive setting
-  if(options.socketOptions && typeof options.socketOptions.keepAlive == 'number') {
-    finalOptions.keepAlive = true;
-    if(typeof options.socketOptions.keepAlive == 'number') {
-      finalOptions.keepAliveInitialDelay = options.socketOptions.keepAlive;
-    }
-  }
-
-  // Connection timeout
-  if(options.socketOptions && typeof options.socketOptions.connectionTimeout == 'number') {
-    finalOptions.connectionTimeout = options.socketOptions.connectionTimeout;
-  }
-
-  // Socket timeout
-  if(options.socketOptions && typeof options.socketOptions.socketTimeout == 'number') {
-    finalOptions.socketTimeout = options.socketOptions.socketTimeout;
-  }
-
-  // noDelay
-  if(options.socketOptions && typeof options.socketOptions.noDelay == 'boolean') {
-    finalOptions.noDelay = options.socketOptions.noDelay;
-  }
-
-  if(typeof options.secondaryAcceptableLatencyMS == 'number') {
-    finalOptions.acceptableLatency = options.secondaryAcceptableLatencyMS;
-  }
-
-  if(options.connectWithNoPrimary == true) {
-    finalOptions.secondaryOnlyConnectionAllowed = true;
-  }
-
-  // Add the non connection store
-  finalOptions.disconnectHandler = store;
-
-  // Translate the options
-  if(options.sslCA) finalOptions.ca = options.sslCA;
-  if(typeof options.sslValidate == 'boolean') finalOptions.rejectUnauthorized = options.sslValidate;
-  if(options.sslKey) finalOptions.key = options.sslKey;
-  if(options.sslCert) finalOptions.cert = options.sslCert;
-  if(options.sslPass) finalOptions.passphrase = options.sslPass;
-
-  // Create the ReplSet
-  var replset = new CReplSet(seedlist, finalOptions)
-  // Server capabilities
-  var sCapabilities = null;
-  // Add auth prbufferMaxEntriesoviders
-  replset.addAuthProvider('mongocr', new MongoCR());
-
-  // Listen to reconnect event
-  replset.on('reconnect', function() {
-    self.emit('reconnect');
-    store.execute();
-  });
-
-  // Internal state
-  this.s = {
-    // Replicaset
-    replset: replset
-    // Server capabilities
-    , sCapabilities: null
-    // Debug tag
-    , tag: options.tag
-    // Store options
-    , storeOptions: storeOptions
-    // Cloned options
-    , clonedOptions: finalOptions
-    // Store
-    , store: store
-    // Options
-    , options: options
-  }
-
-  // Debug
-  if(debug) {
-    // Last ismaster
-    Object.defineProperty(this, 'replset', {
-      enumerable:true, get: function() { return replset; }
-    });
-  }
-
-  // Last ismaster
-  Object.defineProperty(this, 'isMasterDoc', {
-    enumerable:true, get: function() { return replset.lastIsMaster(); }
-  });
-
-  // BSON property
-  Object.defineProperty(this, 'bson', {
-    enumerable: true, get: function() {
-      return replset.bson;
-    }
-  });
-
-  Object.defineProperty(this, 'haInterval', {
-    enumerable:true, get: function() { return replset.haInterval; }
-  });
-}
-
-/**
- * @ignore
- */
-inherits(ReplSet, EventEmitter);
-
-var define = ReplSet.define = new Define('ReplSet', ReplSet, false);
-
-// Ensure the right read Preference object
-var translateReadPreference = function(options) {
-  if(typeof options.readPreference == 'string') {
-    options.readPreference = new CoreReadPreference(options.readPreference);
-  } else if(options.readPreference instanceof ReadPreference) {
-    options.readPreference = new CoreReadPreference(options.readPreference.mode
-      , options.readPreference.tags);
-  }
-
-  return options;
-}
-
-ReplSet.prototype.parserType = function() {
-  return this.s.replset.parserType();
-}
-
-define.classMethod('parserType', {callback: false, promise:false, returns: [String]});
-
-// Connect method
-ReplSet.prototype.connect = function(db, _options, callback) {
-  var self = this;
-  if('function' === typeof _options) callback = _options, _options = {};
-  if(_options == null) _options = {};
-  if(!('function' === typeof callback)) callback = null;
-  self.s.options = _options;
-
-  // Update bufferMaxEntries
-  self.s.storeOptions.bufferMaxEntries = db.bufferMaxEntries;
-
-  // Actual handler
-  var errorHandler = function(event) {
-    return function(err) {
-      if(event != 'error') {
-        self.emit(event, err);
-      }
-    }
-  }
-
-  // Connect handler
-  var connectHandler = function() {
-    // Clear out all the current handlers left over
-    ["timeout", "error", "close"].forEach(function(e) {
-      self.s.replset.removeAllListeners(e);
-    });
-
-    // Set up listeners
-    self.s.replset.once('timeout', errorHandler('timeout'));
-    self.s.replset.once('error', errorHandler('error'));
-    self.s.replset.once('close', errorHandler('close'));
-
-    // relay the event
-    var relay = function(event) {
-      return function(t, server) {
-        self.emit(event, t, server);
-      }
-    }
-
-    // Replset events relay
-    var replsetRelay = function(event) {
-      return function(t, server) {
-        self.emit(event, t, server.lastIsMaster(), server);
-      }
-    }
-
-    // Relay ha
-    var relayHa = function(t, state) {
-      self.emit('ha', t, state);
-
-      if(t == 'start') {
-        self.emit('ha_connect', t, state);
-      } else if(t == 'end') {
-        self.emit('ha_ismaster', t, state);
-      }
-    }
-
-    // Set up serverConfig listeners
-    self.s.replset.on('joined', replsetRelay('joined'));
-    self.s.replset.on('left', relay('left'));
-    self.s.replset.on('ping', relay('ping'));
-    self.s.replset.on('ha', relayHa);
-
-    self.s.replset.on('fullsetup', function(topology) {
-      self.emit('fullsetup', null, self);
-    });
-
-    self.s.replset.on('all', function(topology) {
-      self.emit('all', null, self);
-    });
-
-    // Emit open event
-    self.emit('open', null, self);
-
-    // Return correctly
-    try {
-      callback(null, self);
-    } catch(err) {
-      process.nextTick(function() { throw err; })
-    }
-  }
-
-  // Error handler
-  var connectErrorHandler = function(event) {
-    return function(err) {
-      ['timeout', 'error', 'close'].forEach(function(e) {
-        self.s.replset.removeListener(e, connectErrorHandler);
-      });
-
-      self.s.replset.removeListener('connect', connectErrorHandler);
-      // Destroy the replset
-      self.s.replset.destroy();
-
-      // Try to callback
-      try {
-        callback(err);
-      } catch(err) {
-        if(!self.s.replset.isConnected())
-          process.nextTick(function() { throw err; })
-      }
-    }
-  }
-
-  // Set up listeners
-  self.s.replset.once('timeout', connectErrorHandler('timeout'));
-  self.s.replset.once('error', connectErrorHandler('error'));
-  self.s.replset.once('close', connectErrorHandler('close'));
-  self.s.replset.once('connect', connectHandler);
-
-  // Start connection
-  self.s.replset.connect(_options);
-}
-
-// Server capabilities
-ReplSet.prototype.capabilities = function() {
-  if(this.s.sCapabilities) return this.s.sCapabilities;
-  if(this.s.replset.lastIsMaster() == null) throw MongoError.create({message: 'cannot establish topology capabilities as driver is still in process of connecting', driver:true});
-  this.s.sCapabilities = new ServerCapabilities(this.s.replset.lastIsMaster());
-  return this.s.sCapabilities;
-}
-
-define.classMethod('capabilities', {callback: false, promise:false, returns: [ServerCapabilities]});
-
-// Command
-ReplSet.prototype.command = function(ns, cmd, options, callback) {
-  options = translateReadPreference(options);
-  this.s.replset.command(ns, cmd, options, callback);
-}
-
-define.classMethod('command', {callback: true, promise:false});
-
-// Insert
-ReplSet.prototype.insert = function(ns, ops, options, callback) {
-  this.s.replset.insert(ns, ops, options, callback);
-}
-
-define.classMethod('insert', {callback: true, promise:false});
-
-// Update
-ReplSet.prototype.update = function(ns, ops, options, callback) {
-  this.s.replset.update(ns, ops, options, callback);
-}
-
-define.classMethod('update', {callback: true, promise:false});
-
-// Remove
-ReplSet.prototype.remove = function(ns, ops, options, callback) {
-  this.s.replset.remove(ns, ops, options, callback);
-}
-
-define.classMethod('remove', {callback: true, promise:false});
-
-// IsConnected
-ReplSet.prototype.isConnected = function() {
-  return this.s.replset.isConnected();
-}
-
-define.classMethod('isConnected', {callback: false, promise:false, returns: [Boolean]});
-
-ReplSet.prototype.setBSONParserType = function(type) {
-  return this.s.replset.setBSONParserType(type);
-}
-
-// Insert
-ReplSet.prototype.cursor = function(ns, cmd, options) {
-  options = translateReadPreference(options);
-  options.disconnectHandler = this.s.store;
-  return this.s.replset.cursor(ns, cmd, options);
-}
-
-define.classMethod('cursor', {callback: false, promise:false, returns: [Cursor, AggregationCursor, CommandCursor]});
-
-ReplSet.prototype.lastIsMaster = function() {
-  return this.s.replset.lastIsMaster();
-}
-
-ReplSet.prototype.close = function(forceClosed) {
-  var self = this;
-  this.s.replset.destroy();
-  // We need to wash out all stored processes
-  if(forceClosed == true) {
-    this.s.storeOptions.force = forceClosed;
-    this.s.store.flush();
-  }
-
-  var events = ['timeout', 'error', 'close', 'joined', 'left'];
-  events.forEach(function(e) {
-    self.removeAllListeners(e);
-  });
-}
-
-define.classMethod('close', {callback: false, promise:false});
-
-ReplSet.prototype.auth = function() {
-  var args = Array.prototype.slice.call(arguments, 0);
-  this.s.replset.auth.apply(this.s.replset, args);
-}
-
-define.classMethod('auth', {callback: true, promise:false});
-
-/**
- * All raw connections
- * @method
- * @return {array}
- */
-ReplSet.prototype.connections = function() {
-  return this.s.replset.connections();
-}
-
-define.classMethod('connections', {callback: false, promise:false, returns:[Array]});
-
-/**
- * A replset connect event, used to verify that the connection is up and running
- *
- * @event ReplSet#connect
- * @type {ReplSet}
- */
-
-/**
- * The replset high availability event
- *
- * @event ReplSet#ha
- * @type {function}
- * @param {string} type The stage in the high availability event (start|end)
- * @param {boolean} data.norepeat This is a repeating high availability process or a single execution only
- * @param {number} data.id The id for this high availability request
- * @param {object} data.state An object containing the information about the current replicaset
- */
-
-/**
- * A server member left the replicaset
- *
- * @event ReplSet#left
- * @type {function}
- * @param {string} type The type of member that left (primary|secondary|arbiter)
- * @param {Server} server The server object that left
- */
-
-/**
- * A server member joined the replicaset
- *
- * @event ReplSet#joined
- * @type {function}
- * @param {string} type The type of member that joined (primary|secondary|arbiter)
- * @param {Server} server The server object that joined
- */
-
-/**
- * ReplSet open event, emitted when replicaset can start processing commands.
- *
- * @event ReplSet#open
- * @type {Replset}
- */
-
-/**
- * ReplSet fullsetup event, emitted when all servers in the topology have been connected to.
- *
- * @event ReplSet#fullsetup
- * @type {Replset}
- */
-
-/**
- * ReplSet close event
- *
- * @event ReplSet#close
- * @type {object}
- */
-
-/**
- * ReplSet error event, emitted if there is an error listener.
- *
- * @event ReplSet#error
- * @type {MongoError}
- */
-
-/**
- * ReplSet timeout event
- *
- * @event ReplSet#timeout
- * @type {object}
- */
-
-/**
- * ReplSet parseError event
- *
- * @event ReplSet#parseError
- * @type {object}
- */
-
-module.exports = ReplSet;

http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/6436833c/node_modules/couchbulkimporter/node_modules/mongodb/lib/server.js
----------------------------------------------------------------------
diff --git a/node_modules/couchbulkimporter/node_modules/mongodb/lib/server.js b/node_modules/couchbulkimporter/node_modules/mongodb/lib/server.js
deleted file mode 100644
index eff7771..0000000
--- a/node_modules/couchbulkimporter/node_modules/mongodb/lib/server.js
+++ /dev/null
@@ -1,437 +0,0 @@
-"use strict";
-
-var EventEmitter = require('events').EventEmitter
-  , inherits = require('util').inherits
-  , CServer = require('mongodb-core').Server
-  , Cursor = require('./cursor')
-  , AggregationCursor = require('./aggregation_cursor')
-  , CommandCursor = require('./command_cursor')
-  , f = require('util').format
-  , ServerCapabilities = require('./topology_base').ServerCapabilities
-  , Store = require('./topology_base').Store
-  , Define = require('./metadata')
-  , MongoError = require('mongodb-core').MongoError
-  , shallowClone = require('./utils').shallowClone;
-
-/**
- * @fileOverview The **Server** class is a class that represents a single server topology and is
- * used to construct connections.
- *
- * **Server Should not be used, use MongoClient.connect**
- * @example
- * var Db = require('mongodb').Db,
- *   Server = require('mongodb').Server,
- *   test = require('assert');
- * // Connect using single Server
- * var db = new Db('test', new Server('localhost', 27017););
- * db.open(function(err, db) {
- *   // Get an additional db
- *   db.close();
- * });
- */
-
-/**
- * Creates a new Server instance
- * @class
- * @deprecated
- * @param {string} host The host for the server, can be either an IP4, IP6 or domain socket style host.
- * @param {number} [port] The server port if IP4.
- * @param {object} [options=null] Optional settings.
- * @param {number} [options.poolSize=5] Number of connections in the connection pool for each server instance, set to 5 as default for legacy reasons.
- * @param {boolean} [options.ssl=false] Use ssl connection (needs to have a mongod server with ssl support)
- * @param {object} [options.sslValidate=true] Validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher)
- * @param {array} [options.sslCA=null] Array of valid certificates either as Buffers or Strings (needs to have a mongod server with ssl support, 2.4 or higher)
- * @param {(Buffer|string)} [options.sslCert=null] String or buffer containing the certificate we wish to present (needs to have a mongod server with ssl support, 2.4 or higher)
- * @param {(Buffer|string)} [options.sslKey=null] String or buffer containing the certificate private key we wish to present (needs to have a mongod server with ssl support, 2.4 or higher)
- * @param {(Buffer|string)} [options.sslPass=null] String or buffer containing the certificate password (needs to have a mongod server with ssl support, 2.4 or higher)
- * @param {object} [options.socketOptions=null] Socket options
- * @param {boolean} [options.socketOptions.autoReconnect=false] Reconnect on error.
- * @param {boolean} [options.socketOptions.noDelay=true] TCP Socket NoDelay option.
- * @param {number} [options.socketOptions.keepAlive=0] TCP KeepAlive on the socket with a X ms delay before start.
- * @param {number} [options.socketOptions.connectTimeoutMS=0] TCP Connection timeout setting
- * @param {number} [options.socketOptions.socketTimeoutMS=0] TCP Socket timeout setting
- * @param {number} [options.reconnectTries=30] Server attempt to reconnect #times
- * @param {number} [options.reconnectInterval=1000] Server will wait # milliseconds between retries
- * @fires Server#connect
- * @fires Server#close
- * @fires Server#error
- * @fires Server#timeout
- * @fires Server#parseError
- * @fires Server#reconnect
- * @return {Server} a Server instance.
- */
-var Server = function(host, port, options) {
-  options = options || {};
-  if(!(this instanceof Server)) return new Server(host, port, options);
-  EventEmitter.call(this);
-  var self = this;
-
-  // Store option defaults
-  var storeOptions = {
-      force: false
-    , bufferMaxEntries: -1
-  }
-
-  // Shared global store
-  var store = options.store || new Store(self, storeOptions);
-
-  // Detect if we have a socket connection
-  if(host.indexOf('\/') != -1) {
-    if(port != null && typeof port == 'object') {
-      options = port;
-      port = null;
-    }
-  } else if(port == null) {
-    throw MongoError.create({message: 'port must be specified', driver:true});
-  }
-
-  // Clone options
-  var clonedOptions = shallowClone(options);
-  clonedOptions.host = host;
-  clonedOptions.port = port;
-
-  // Reconnect
-  var reconnect = typeof options.auto_reconnect == 'boolean' ? options.auto_reconnect : true;
-  reconnect = typeof options.autoReconnect == 'boolean' ? options.autoReconnect : reconnect;
-  var emitError = typeof options.emitError == 'boolean' ? options.emitError : true;
-  var poolSize = typeof options.poolSize == 'number' ? options.poolSize : 5;
-
-  // Socket options passed down
-  if(options.socketOptions) {
-    if(options.socketOptions.connectTimeoutMS) {
-      this.connectTimeoutMS = options.socketOptions.connectTimeoutMS;
-      clonedOptions.connectionTimeout = options.socketOptions.connectTimeoutMS;
-    }
-
-    if(options.socketOptions.socketTimeoutMS) {
-      clonedOptions.socketTimeout = options.socketOptions.socketTimeoutMS;
-    }
-
-    if(typeof options.socketOptions.keepAlive == 'number') {
-      clonedOptions.keepAliveInitialDelay = options.socketOptions.keepAlive;
-      clonedOptions.keepAlive = true;
-    }
-
-    if(typeof options.socketOptions.noDelay == 'boolean') {
-      clonedOptions.noDelay = options.socketOptions.noDelay;
-    }
-  }
-
-  // Add the cursor factory function
-  clonedOptions.cursorFactory = Cursor;
-  clonedOptions.reconnect = reconnect;
-  clonedOptions.emitError = emitError;
-  clonedOptions.size = poolSize;
-
-  // Translate the options
-  if(clonedOptions.sslCA) clonedOptions.ca = clonedOptions.sslCA;
-  if(typeof clonedOptions.sslValidate == 'boolean') clonedOptions.rejectUnauthorized = clonedOptions.sslValidate;
-  if(clonedOptions.sslKey) clonedOptions.key = clonedOptions.sslKey;
-  if(clonedOptions.sslCert) clonedOptions.cert = clonedOptions.sslCert;
-  if(clonedOptions.sslPass) clonedOptions.passphrase = clonedOptions.sslPass;
-
-  // Add the non connection store
-  clonedOptions.disconnectHandler = store;
-
-  // Create an instance of a server instance from mongodb-core
-  var server = new CServer(clonedOptions);
-  // Server capabilities
-  var sCapabilities = null;
-
-  // Define the internal properties
-  this.s = {
-    // Create an instance of a server instance from mongodb-core
-      server: server
-    // Server capabilities
-    , sCapabilities: null
-    // Cloned options
-    , clonedOptions: clonedOptions
-    // Reconnect
-    , reconnect: reconnect
-    // Emit error
-    , emitError: emitError
-    // Pool size
-    , poolSize: poolSize
-    // Store Options
-    , storeOptions: storeOptions
-    // Store
-    , store: store
-    // Host
-    , host: host
-    // Port
-    , port: port
-    // Options
-    , options: options
-  }
-
-  // BSON property
-  Object.defineProperty(this, 'bson', {
-    enumerable: true, get: function() {
-      return self.s.server.bson;
-    }
-  });
-
-  // Last ismaster
-  Object.defineProperty(this, 'isMasterDoc', {
-    enumerable:true, get: function() {
-      return self.s.server.lastIsMaster();
-    }
-  });
-
-  // Last ismaster
-  Object.defineProperty(this, 'poolSize', {
-    enumerable:true, get: function() { return self.s.server.connections().length; }
-  });
-
-  Object.defineProperty(this, 'autoReconnect', {
-    enumerable:true, get: function() { return self.s.reconnect; }
-  });
-
-  Object.defineProperty(this, 'host', {
-    enumerable:true, get: function() { return self.s.host; }
-  });
-
-  Object.defineProperty(this, 'port', {
-    enumerable:true, get: function() { return self.s.port; }
-  });
-}
-
-inherits(Server, EventEmitter);
-
-var define = Server.define = new Define('Server', Server, false);
-
-Server.prototype.parserType = function() {
-  return this.s.server.parserType();
-}
-
-define.classMethod('parserType', {callback: false, promise:false, returns: [String]});
-
-// Connect
-Server.prototype.connect = function(db, _options, callback) {
-  var self = this;
-  if('function' === typeof _options) callback = _options, _options = {};
-  if(_options == null) _options = {};
-  if(!('function' === typeof callback)) callback = null;
-  self.s.options = _options;
-
-  // Update bufferMaxEntries
-  self.s.storeOptions.bufferMaxEntries = db.bufferMaxEntries;
-
-  // Error handler
-  var connectErrorHandler = function(event) {
-    return function(err) {
-      // Remove all event handlers
-      var events = ['timeout', 'error', 'close'];
-      events.forEach(function(e) {
-        self.s.server.removeListener(e, connectHandlers[e]);
-      });
-
-      self.s.server.removeListener('connect', connectErrorHandler);
-
-      // Try to callback
-      try {
-        callback(err);
-      } catch(err) {
-        process.nextTick(function() { throw err; })
-      }
-    }
-  }
-
-  // Actual handler
-  var errorHandler = function(event) {
-    return function(err) {
-      if(event != 'error') {
-        self.emit(event, err);
-      }
-    }
-  }
-
-  // Error handler
-  var reconnectHandler = function(err) {
-    self.emit('reconnect', self);
-    self.s.store.execute();
-  }
-
-  // Destroy called on topology, perform cleanup
-  var destroyHandler = function() {
-    self.s.store.flush();
-  }
-
-  // Connect handler
-  var connectHandler = function() {
-    // Clear out all the current handlers left over
-    ["timeout", "error", "close"].forEach(function(e) {
-      self.s.server.removeAllListeners(e);
-    });
-
-    // Set up listeners
-    self.s.server.once('timeout', errorHandler('timeout'));
-    self.s.server.once('error', errorHandler('error'));
-    self.s.server.on('close', errorHandler('close'));
-    // Only called on destroy
-    self.s.server.once('destroy', destroyHandler);
-
-    // Emit open event
-    self.emit('open', null, self);
-
-    // Return correctly
-    try {
-      callback(null, self);
-    } catch(err) {
-      console.log(err.stack)
-      process.nextTick(function() { throw err; })
-    }
-  }
-
-  // Set up listeners
-  var connectHandlers = {
-    timeout: connectErrorHandler('timeout'),
-    error: connectErrorHandler('error'),
-    close: connectErrorHandler('close')
-  };
-
-  // Add the event handlers
-  self.s.server.once('timeout', connectHandlers.timeout);
-  self.s.server.once('error', connectHandlers.error);
-  self.s.server.once('close', connectHandlers.close);
-  self.s.server.once('connect', connectHandler);
-  // Reconnect server
-  self.s.server.on('reconnect', reconnectHandler);
-
-  // Start connection
-  self.s.server.connect(_options);
-}
-
-// Server capabilities
-Server.prototype.capabilities = function() {
-  if(this.s.sCapabilities) return this.s.sCapabilities;
-  if(this.s.server.lastIsMaster() == null) throw MongoError.create({message: 'cannot establish topology capabilities as driver is still in process of connecting', driver:true});
-  this.s.sCapabilities = new ServerCapabilities(this.s.server.lastIsMaster());
-  return this.s.sCapabilities;
-}
-
-define.classMethod('capabilities', {callback: false, promise:false, returns: [ServerCapabilities]});
-
-// Command
-Server.prototype.command = function(ns, cmd, options, callback) {
-  this.s.server.command(ns, cmd, options, callback);
-}
-
-define.classMethod('command', {callback: true, promise:false});
-
-// Insert
-Server.prototype.insert = function(ns, ops, options, callback) {
-  this.s.server.insert(ns, ops, options, callback);
-}
-
-define.classMethod('insert', {callback: true, promise:false});
-
-// Update
-Server.prototype.update = function(ns, ops, options, callback) {
-  this.s.server.update(ns, ops, options, callback);
-}
-
-define.classMethod('update', {callback: true, promise:false});
-
-// Remove
-Server.prototype.remove = function(ns, ops, options, callback) {
-  this.s.server.remove(ns, ops, options, callback);
-}
-
-define.classMethod('remove', {callback: true, promise:false});
-
-// IsConnected
-Server.prototype.isConnected = function() {
-  return this.s.server.isConnected();
-}
-
-define.classMethod('isConnected', {callback: false, promise:false, returns: [Boolean]});
-
-// Insert
-Server.prototype.cursor = function(ns, cmd, options) {
-  options.disconnectHandler = this.s.store;
-  return this.s.server.cursor(ns, cmd, options);
-}
-
-define.classMethod('cursor', {callback: false, promise:false, returns: [Cursor, AggregationCursor, CommandCursor]});
-
-Server.prototype.setBSONParserType = function(type) {
-  return this.s.server.setBSONParserType(type);
-}
-
-Server.prototype.lastIsMaster = function() {
-  return this.s.server.lastIsMaster();
-}
-
-Server.prototype.close = function(forceClosed) {
-  this.s.server.destroy();
-  // We need to wash out all stored processes
-  if(forceClosed == true) {
-    this.s.storeOptions.force = forceClosed;
-    this.s.store.flush();
-  }
-}
-
-define.classMethod('close', {callback: false, promise:false});
-
-Server.prototype.auth = function() {
-  var args = Array.prototype.slice.call(arguments, 0);
-  this.s.server.auth.apply(this.s.server, args);
-}
-
-define.classMethod('auth', {callback: true, promise:false});
-
-/**
- * All raw connections
- * @method
- * @return {array}
- */
-Server.prototype.connections = function() {
-  return this.s.server.connections();
-}
-
-define.classMethod('connections', {callback: false, promise:false, returns:[Array]});
-
-/**
- * Server connect event
- *
- * @event Server#connect
- * @type {object}
- */
-
-/**
- * Server close event
- *
- * @event Server#close
- * @type {object}
- */
-
-/**
- * Server reconnect event
- *
- * @event Server#reconnect
- * @type {object}
- */
-
-/**
- * Server error event
- *
- * @event Server#error
- * @type {MongoError}
- */
-
-/**
- * Server timeout event
- *
- * @event Server#timeout
- * @type {object}
- */
-
-/**
- * Server parseError event
- *
- * @event Server#parseError
- * @type {object}
- */
-
-module.exports = Server;

http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/6436833c/node_modules/couchbulkimporter/node_modules/mongodb/lib/topology_base.js
----------------------------------------------------------------------
diff --git a/node_modules/couchbulkimporter/node_modules/mongodb/lib/topology_base.js b/node_modules/couchbulkimporter/node_modules/mongodb/lib/topology_base.js
deleted file mode 100644
index 000f7ec..0000000
--- a/node_modules/couchbulkimporter/node_modules/mongodb/lib/topology_base.js
+++ /dev/null
@@ -1,152 +0,0 @@
-"use strict";
-
-var MongoError = require('mongodb-core').MongoError
-  , f = require('util').format;
-
-// The store of ops
-var Store = function(topology, storeOptions) {
-  var self = this;
-  var storedOps = [];
-  storeOptions = storeOptions || {force:false, bufferMaxEntries: -1}
-
-  // Internal state
-  this.s = {
-      storedOps: storedOps
-    , storeOptions: storeOptions
-    , topology: topology
-  }
-
-  Object.defineProperty(this, 'length', {
-    enumerable:true, get: function() { return self.s.storedOps.length; }
-  });
-}
-
-Store.prototype.add = function(opType, ns, ops, options, callback) {
-  if(this.s.storeOptions.force) {
-    return callback(MongoError.create({message: "db closed by application", driver:true}));
-  }
-
-  if(this.s.storeOptions.bufferMaxEntries == 0) {
-    return callback(MongoError.create({message: f("no connection available for operation and number of stored operation > %s", this.s.storeOptions.bufferMaxEntries), driver:true }));
-  }
-
-  if(this.s.storeOptions.bufferMaxEntries > 0 && this.s.storedOps.length > this.s.storeOptions.bufferMaxEntries) {
-    while(this.s.storedOps.length > 0) {
-      var op = this.s.storedOps.shift();
-      op.c(MongoError.create({message: f("no connection available for operation and number of stored operation > %s", this.s.storeOptions.bufferMaxEntries), driver:true }));
-    }
-
-    return;
-  }
-
-  this.s.storedOps.push({t: opType, n: ns, o: ops, op: options, c: callback})
-}
-
-Store.prototype.addObjectAndMethod = function(opType, object, method, params, callback) {
-  if(this.s.storeOptions.force) {
-    return callback(MongoError.create({message: "db closed by application", driver:true }));
-  }
-
-  if(this.s.storeOptions.bufferMaxEntries == 0) {
-    return callback(MongoError.create({message: f("no connection available for operation and number of stored operation > %s", this.s.storeOptions.bufferMaxEntries), driver:true }));
-  }
-
-  if(this.s.storeOptions.bufferMaxEntries > 0 && this.s.storedOps.length > this.s.storeOptions.bufferMaxEntries) {
-    while(this.s.storedOps.length > 0) {
-      var op = this.s.storedOps.shift();
-      op.c(MongoError.create({message: f("no connection available for operation and number of stored operation > %s", this.s.storeOptions.bufferMaxEntries), driver:true }));
-    }
-
-    return;
-  }
-
-  this.s.storedOps.push({t: opType, m: method, o: object, p: params, c: callback})
-}
-
-Store.prototype.flush = function() {
-  while(this.s.storedOps.length > 0) {
-    this.s.storedOps.shift().c(MongoError.create({message: f("no connection available for operation"), driver:true }));
-  }
-}
-
-Store.prototype.execute = function() {
-  // Get current ops
-  var ops = this.s.storedOps;
-  // Reset the ops
-  this.s.storedOps = [];
-
-  // Execute all the stored ops
-  while(ops.length > 0) {
-    var op = ops.shift();
-
-    if(op.t == 'cursor') {
-      op.o[op.m].apply(op.o, op.p);
-    } else {
-      this.s.topology[op.t](op.n, op.o, op.op, op.c);
-    }
-  }
-}
-
-Store.prototype.all = function() {
-  return this.s.storedOps;
-}
-
-// Server capabilities
-var ServerCapabilities = function(ismaster) {
-  var setup_get_property = function(object, name, value) {
-    Object.defineProperty(object, name, {
-        enumerable: true
-      , get: function () { return value; }
-    });
-  }
-
-  // Capabilities
-  var aggregationCursor = false;
-  var writeCommands = false;
-  var textSearch = false;
-  var authCommands = false;
-  var listCollections = false;
-  var listIndexes = false;
-  var maxNumberOfDocsInBatch = ismaster.maxWriteBatchSize || 1000;
-
-  if(ismaster.minWireVersion >= 0) {
-    textSearch = true;
-  }
-
-  if(ismaster.maxWireVersion >= 1) {
-    aggregationCursor = true;
-    authCommands = true;
-  }
-
-  if(ismaster.maxWireVersion >= 2) {
-    writeCommands = true;
-  }
-
-  if(ismaster.maxWireVersion >= 3) {
-    listCollections = true;
-    listIndexes = true;
-  }
-
-  // If no min or max wire version set to 0
-  if(ismaster.minWireVersion == null) {
-    ismaster.minWireVersion = 0;
-  }
-
-  if(ismaster.maxWireVersion == null) {
-    ismaster.maxWireVersion = 0;
-  }
-
-  // Map up read only parameters
-  setup_get_property(this, "hasAggregationCursor", aggregationCursor);
-  setup_get_property(this, "hasWriteCommands", writeCommands);
-  setup_get_property(this, "hasTextSearch", textSearch);
-  setup_get_property(this, "hasAuthCommands", authCommands);
-  setup_get_property(this, "hasListCollectionsCommand", listCollections);
-  setup_get_property(this, "hasListIndexesCommand", listIndexes);
-  setup_get_property(this, "minWireVersion", ismaster.minWireVersion);
-  setup_get_property(this, "maxWireVersion", ismaster.maxWireVersion);
-  setup_get_property(this, "maxNumberOfDocsInBatch", maxNumberOfDocsInBatch);
-}
-
-exports.Store = Store;
-exports.ServerCapabilities = ServerCapabilities;

http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/6436833c/node_modules/couchbulkimporter/node_modules/mongodb/lib/url_parser.js
----------------------------------------------------------------------
diff --git a/node_modules/couchbulkimporter/node_modules/mongodb/lib/url_parser.js b/node_modules/couchbulkimporter/node_modules/mongodb/lib/url_parser.js
deleted file mode 100644
index eccc1e0..0000000
--- a/node_modules/couchbulkimporter/node_modules/mongodb/lib/url_parser.js
+++ /dev/null
@@ -1,295 +0,0 @@
-"use strict";
-
-var ReadPreference = require('./read_preference');
-
-module.exports = function(url, options) {
-  // Ensure we have a default options object if none set
-  options = options || {};
-  // Variables
-  var connection_part = '';
-  var auth_part = '';
-  var query_string_part = '';
-  var dbName = 'admin';
-
-  // Must start with mongodb
-  if(url.indexOf("mongodb://") != 0)
-    throw Error("URL must be in the format mongodb://user:pass@host:port/dbname");
-  // If we have a ? mark cut the query elements off
-  if(url.indexOf("?") != -1) {
-    query_string_part = url.substr(url.indexOf("?") + 1);
-    connection_part = url.substring("mongodb://".length, url.indexOf("?"))
-  } else {
-    connection_part = url.substring("mongodb://".length);
-  }
-
-  // Check if we have auth params
-  if(connection_part.indexOf("@") != -1) {
-    auth_part = connection_part.split("@")[0];
-    connection_part = connection_part.split("@")[1];
-  }
-
-  // Check if the connection string has a db
-  if(connection_part.indexOf(".sock") != -1) {
-    if(connection_part.indexOf(".sock/") != -1) {
-      dbName = connection_part.split(".sock/")[1];
-      connection_part = connection_part.split("/", connection_part.indexOf(".sock") + ".sock".length);
-    }
-  } else if(connection_part.indexOf("/") != -1) {
-    dbName = connection_part.split("/")[1];
-    connection_part = connection_part.split("/")[0];
-  }
-
-  // Result object
-  var object = {};
-
-  // Pick apart the authentication part of the string
-  var authPart = auth_part || '';
-  var auth = authPart.split(':', 2);
-
-  // Decode the URI components
-  auth[0] = decodeURIComponent(auth[0]);
-  if(auth[1]){
-    auth[1] = decodeURIComponent(auth[1]);
-  }
-
-  // Add auth to final object if we have 2 elements
-  if(auth.length == 2) object.auth = {user: auth[0], password: auth[1]};
-
-  // Variables used for temporary storage
-  var hostPart;
-  var urlOptions;
-  var servers;
-  var serverOptions = {socketOptions: {}};
-  var dbOptions = {read_preference_tags: []};
-  var replSetServersOptions = {socketOptions: {}};
-  // Add server options to final object
-  object.server_options = serverOptions;
-  object.db_options = dbOptions;
-  object.rs_options = replSetServersOptions;
-  object.mongos_options = {};
-
-  // Let's check if we are using a domain socket
-  if(url.match(/\.sock/)) {
-    // Split out the socket part
-    var domainSocket = url.substring(
-        url.indexOf("mongodb://") + "mongodb://".length
-      , url.lastIndexOf(".sock") + ".sock".length);
-    // Clean out any auth stuff if any
-    if(domainSocket.indexOf("@") != -1) domainSocket = domainSocket.split("@")[1];
-    servers = [{domain_socket: domainSocket}];
-  } else {
-    // Split up the db
-    hostPart = connection_part;
-    // Deduplicate servers
-    var deduplicatedServers = {};
-
-    // Parse all server results
-    servers = hostPart.split(',').map(function(h) {
-      var _host, _port, ipv6match;
-      //check if it matches [IPv6]:port, where the port number is optional
-      if ((ipv6match = /\[([^\]]+)\](?:\:(.+))?/.exec(h))) {
-        _host = ipv6match[1];
-        _port = parseInt(ipv6match[2], 10) || 27017;
-      } else {
-        //otherwise assume it's IPv4, or plain hostname
-        var hostPort = h.split(':', 2);
-        _host = hostPort[0] || 'localhost';
-        _port = hostPort[1] != null ? parseInt(hostPort[1], 10) : 27017;
-        // Check for localhost?safe=true style case
-        if(_host.indexOf("?") != -1) _host = _host.split(/\?/)[0];
-      }
-
-      // No entry returned for duplicate servr
-      if(deduplicatedServers[_host + "_" + _port]) return null;
-      deduplicatedServers[_host + "_" + _port] = 1;
-
-      // Return the mapped object
-      return {host: _host, port: _port};
-    }).filter(function(x) {
-      return x != null;
-    });
-  }
-
-  // Get the db name
-  object.dbName = dbName || 'admin';
-  // Split up all the options
-  urlOptions = (query_string_part || '').split(/[&;]/);
-  // Ugh, we have to figure out which options go to which constructor manually.
-  urlOptions.forEach(function(opt) {
-    if(!opt) return;
-    var splitOpt = opt.split('='), name = splitOpt[0], value = splitOpt[1];
-    // Options implementations
-    switch(name) {
-      case 'slaveOk':
-      case 'slave_ok':
-        serverOptions.slave_ok = (value == 'true');
-        dbOptions.slaveOk = (value == 'true');
-        break;
-      case 'maxPoolSize':
-      case 'poolSize':
-        serverOptions.poolSize = parseInt(value, 10);
-        replSetServersOptions.poolSize = parseInt(value, 10);
-        break;
-      case 'autoReconnect':
-      case 'auto_reconnect':
-        serverOptions.auto_reconnect = (value == 'true');
-        break;
-      case 'minPoolSize':
-        throw new Error("minPoolSize not supported");
-      case 'maxIdleTimeMS':
-        throw new Error("maxIdleTimeMS not supported");
-      case 'waitQueueMultiple':
-        throw new Error("waitQueueMultiple not supported");
-      case 'waitQueueTimeoutMS':
-        throw new Error("waitQueueTimeoutMS not supported");
-      case 'uuidRepresentation':
-        throw new Error("uuidRepresentation not supported");
-      case 'ssl':
-        if(value == 'prefer') {
-          serverOptions.ssl = value;
-          replSetServersOptions.ssl = value;
-          break;
-        }
-        serverOptions.ssl = (value == 'true');
-        replSetServersOptions.ssl = (value == 'true');
-        break;
-      case 'replicaSet':
-      case 'rs_name':
-        replSetServersOptions.rs_name = value;
-        break;
-      case 'reconnectWait':
-        replSetServersOptions.reconnectWait = parseInt(value, 10);
-        break;
-      case 'retries':
-        replSetServersOptions.retries = parseInt(value, 10);
-        break;
-      case 'readSecondary':
-      case 'read_secondary':
-        replSetServersOptions.read_secondary = (value == 'true');
-        break;
-      case 'fsync':
-        dbOptions.fsync = (value == 'true');
-        break;
-      case 'journal':
-        dbOptions.j = (value == 'true');
-        break;
-      case 'safe':
-        dbOptions.safe = (value == 'true');
-        break;
-      case 'nativeParser':
-      case 'native_parser':
-        dbOptions.native_parser = (value == 'true');
-        break;
-      case 'readConcernLevel':
-        dbOptions.readConcern = {level: value};
-        break;
-      case 'connectTimeoutMS':
-        serverOptions.socketOptions.connectTimeoutMS = parseInt(value, 10);
-        replSetServersOptions.socketOptions.connectTimeoutMS = parseInt(value, 10);
-        break;
-      case 'socketTimeoutMS':
-        serverOptions.socketOptions.socketTimeoutMS = parseInt(value, 10);
-        replSetServersOptions.socketOptions.socketTimeoutMS = parseInt(value, 10);
-        break;
-      case 'w':
-        dbOptions.w = parseInt(value, 10);
-        if(isNaN(dbOptions.w)) dbOptions.w = value;
-        break;
-      case 'authSource':
-        dbOptions.authSource = value;
-        break;
-      case 'gssapiServiceName':
-        dbOptions.gssapiServiceName = value;
-        break;
-      case 'authMechanism':
-        if(value == 'GSSAPI') {
-          // If no password provided decode only the principal
-          if(object.auth == null) {
-            var urlDecodeAuthPart = decodeURIComponent(authPart);
-            if(urlDecodeAuthPart.indexOf("@") == -1) throw new Error("GSSAPI requires a provided principal");
-            object.auth = {user: urlDecodeAuthPart, password: null};
-          } else {
-            object.auth.user = decodeURIComponent(object.auth.user);
-          }
-        } else if(value == 'MONGODB-X509') {
-          object.auth = {user: decodeURIComponent(authPart)};
-        }
-
-        // Only support GSSAPI or MONGODB-CR for now
-        if(value != 'GSSAPI'
-          && value != 'MONGODB-X509'
-          && value != 'MONGODB-CR'
-          && value != 'DEFAULT'
-          && value != 'SCRAM-SHA-1'
-          && value != 'PLAIN')
-            throw new Error("only DEFAULT, GSSAPI, PLAIN, MONGODB-X509, SCRAM-SHA-1 or MONGODB-CR is supported by authMechanism");
-
-        // Authentication mechanism
-        dbOptions.authMechanism = value;
-        break;
-      case 'authMechanismProperties':
-        // Split up into key, value pairs
-        var values = value.split(',');
-        var o = {};
-        // For each value split into key, value
-        values.forEach(function(x) {
-          var v = x.split(':');
-          o[v[0]] = v[1];
-        });
-
-        // Set all authMechanismProperties
-        dbOptions.authMechanismProperties = o;
-        // Set the service name value
-        if(typeof o.SERVICE_NAME == 'string') dbOptions.gssapiServiceName = o.SERVICE_NAME;
-        break;
-      case 'wtimeoutMS':
-        dbOptions.wtimeout = parseInt(value, 10);
-        break;
-      case 'readPreference':
-        if(!ReadPreference.isValid(value)) throw new Error("readPreference must be either primary/primaryPreferred/secondary/secondaryPreferred/nearest");
-        dbOptions.read_preference = value;
-        break;
-      case 'readPreferenceTags':
-        // Decode the value
-        value = decodeURIComponent(value);
-        // Contains the tag object
-        var tagObject = {};
-        if(value == null || value == '') {
-          dbOptions.read_preference_tags.push(tagObject);
-          break;
-        }
-
-        // Split up the tags
-        var tags = value.split(/\,/);
-        for(var i = 0; i < tags.length; i++) {
-          var parts = tags[i].trim().split(/\:/);
-          tagObject[parts[0]] = parts[1];
-        }
-
-        // Set the preferences tags
-        dbOptions.read_preference_tags.push(tagObject);
-        break;
-      default:
-        break;
-    }
-  });
-
-  // No tags: should be null (not [])
-  if(dbOptions.read_preference_tags.length === 0) {
-    dbOptions.read_preference_tags = null;
-  }
-
-  // Validate if there are an invalid write concern combinations
-  if((dbOptions.w == -1 || dbOptions.w == 0) && (
-      dbOptions.journal == true
-      || dbOptions.fsync == true
-      || dbOptions.safe == true)) throw new Error("w set to -1 or 0 cannot be combined with safe/w/journal/fsync")
-
-  // If no read preference set it to primary
-  if(!dbOptions.read_preference) dbOptions.read_preference = 'primary';
-
-  // Add servers to result
-  object.servers = servers;
-  // Returned parsed object
-  return object;
-}

http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/6436833c/node_modules/couchbulkimporter/node_modules/mongodb/lib/utils.js
----------------------------------------------------------------------
diff --git a/node_modules/couchbulkimporter/node_modules/mongodb/lib/utils.js b/node_modules/couchbulkimporter/node_modules/mongodb/lib/utils.js
deleted file mode 100644
index cb20e67..0000000
--- a/node_modules/couchbulkimporter/node_modules/mongodb/lib/utils.js
+++ /dev/null
@@ -1,234 +0,0 @@
-"use strict";
-
-var MongoError = require('mongodb-core').MongoError,
-  f = require('util').format;
-
-var shallowClone = function(obj) {
-  var copy = {};
-  for(var name in obj) copy[name] = obj[name];
-  return copy;
-}
-
-// Set simple property
-var getSingleProperty = function(obj, name, value) {
-  Object.defineProperty(obj, name, {
-    enumerable:true,
-    get: function() {
-      return value
-    }
-  });
-}
-
-var formatSortValue = exports.formatSortValue = function(sortDirection) {
-  var value = ("" + sortDirection).toLowerCase();
-
-  switch (value) {
-    case 'ascending':
-    case 'asc':
-    case '1':
-      return 1;
-    case 'descending':
-    case 'desc':
-    case '-1':
-      return -1;
-    default:
-      throw new Error("Illegal sort clause, must be of the form "
-                    + "[['field1', '(ascending|descending)'], "
-                    + "['field2', '(ascending|descending)']]");
-  }
-};
-
-var formattedOrderClause = exports.formattedOrderClause = function(sortValue) {
-  var orderBy = {};
-  if(sortValue == null) return null;
-  if (Array.isArray(sortValue)) {
-    if(sortValue.length === 0) {
-      return null;
-    }
-
-    for(var i = 0; i < sortValue.length; i++) {
-      if(sortValue[i].constructor == String) {
-        orderBy[sortValue[i]] = 1;
-      } else {
-        orderBy[sortValue[i][0]] = formatSortValue(sortValue[i][1]);
-      }
-    }
-  } else if(sortValue != null && typeof sortValue == 'object') {
-    orderBy = sortValue;
-  } else if (typeof sortValue == 'string') {
-    orderBy[sortValue] = 1;
-  } else {
-    throw new Error("Illegal sort clause, must be of the form " +
-      "[['field1', '(ascending|descending)'], ['field2', '(ascending|descending)']]");
-  }
-
-  return orderBy;
-};
-
-var checkCollectionName = function checkCollectionName (collectionName) {
-  if('string' !== typeof collectionName) {
-    throw Error("collection name must be a String");
-  }
-
-  if(!collectionName || collectionName.indexOf('..') != -1) {
-    throw Error("collection names cannot be empty");
-  }
-
-  if(collectionName.indexOf('$') != -1 &&
-      collectionName.match(/((^\$cmd)|(oplog\.\$main))/) == null) {
-    throw Error("collection names must not contain '$'");
-  }
-
-  if(collectionName.match(/^\.|\.$/) != null) {
-    throw Error("collection names must not start or end with '.'");
-  }
-
-  // Validate that we are not passing 0x00 in the colletion name
-  if(!!~collectionName.indexOf("\x00")) {
-    throw new Error("collection names cannot contain a null character");
-  }
-};
-
-var handleCallback = function(callback, err, value1, value2) {
-  try {
-    if(callback == null) return;
-    if(value2) return callback(err, value1, value2);
-    return callback(err, value1);
-  } catch(err) {
-    process.nextTick(function() { throw err; });
-    return false;
-  }
-
-  return true;
-}
-
-/**
- * Wrap a Mongo error document in an Error instance
- * @ignore
- * @api private
- */
-var toError = function(error) {
-  if (error instanceof Error) return error;
-
-  var msg = error.err || error.errmsg || error.errMessage || error;
-  var e = MongoError.create({message: msg, driver:true});
-
-  // Get all object keys
-  var keys = typeof error == 'object'
-    ? Object.keys(error)
-    : [];
-
-  for(var i = 0; i < keys.length; i++) {
-    e[keys[i]] = error[keys[i]];
-  }
-
-  return e;
-}
-
-/**
- * @ignore
- */
-var normalizeHintField = function normalizeHintField(hint) {
-  var finalHint = null;
-
-  if(typeof hint == 'string') {
-    finalHint = hint;
-  } else if(Array.isArray(hint)) {
-    finalHint = {};
-
-    hint.forEach(function(param) {
-      finalHint[param] = 1;
-    });
-  } else if(hint != null && typeof hint == 'object') {
-    finalHint = {};
-    for (var name in hint) {
-      finalHint[name] = hint[name];
-    }
-  }
-
-  return finalHint;
-};
-
-/**
- * Create index name based on field spec
- *
- * @ignore
- * @api private
- */
-var parseIndexOptions = function(fieldOrSpec) {
-  var fieldHash = {};
-  var indexes = [];
-  var keys;
-
-  // Get all the fields accordingly
-  if('string' == typeof fieldOrSpec) {
-    // 'type'
-    indexes.push(fieldOrSpec + '_' + 1);
-    fieldHash[fieldOrSpec] = 1;
-  } else if(Array.isArray(fieldOrSpec)) {
-    fieldOrSpec.forEach(function(f) {
-      if('string' == typeof f) {
-        // [{location:'2d'}, 'type']
-        indexes.push(f + '_' + 1);
-        fieldHash[f] = 1;
-      } else if(Array.isArray(f)) {
-        // [['location', '2d'],['type', 1]]
-        indexes.push(f[0] + '_' + (f[1] || 1));
-        fieldHash[f[0]] = f[1] || 1;
-      } else if(isObject(f)) {
-        // [{location:'2d'}, {type:1}]
-        keys = Object.keys(f);
-        keys.forEach(function(k) {
-          indexes.push(k + '_' + f[k]);
-          fieldHash[k] = f[k];
-        });
-      } else {
-        // undefined (ignore)
-      }
-    });
-  } else if(isObject(fieldOrSpec)) {
-    // {location:'2d', type:1}
-    keys = Object.keys(fieldOrSpec);
-    keys.forEach(function(key) {
-      indexes.push(key + '_' + fieldOrSpec[key]);
-      fieldHash[key] = fieldOrSpec[key];
-    });
-  }
-
-  return {
-    name: indexes.join("_"), keys: keys, fieldHash: fieldHash
-  }
-}
-
-var isObject = exports.isObject = function (arg) {
-  return '[object Object]' == toString.call(arg)
-}
-
-var debugOptions = function(debugFields, options) {
-  var finaloptions = {};
-  debugFields.forEach(function(n) {
-    finaloptions[n] = options[n];
-  });
-
-  return finaloptions;
-}
-
-var decorateCommand = function(command, options, exclude) {
-  for(var name in options) {
-    if(exclude[name] == null) command[name] = options[name];
-  }
-
-  return command;
-}
-
-exports.shallowClone = shallowClone;
-exports.getSingleProperty = getSingleProperty;
-exports.checkCollectionName = checkCollectionName;
-exports.toError = toError;
-exports.formattedOrderClause = formattedOrderClause;
-exports.parseIndexOptions = parseIndexOptions;
-exports.normalizeHintField = normalizeHintField;
-exports.handleCallback = handleCallback;
-exports.decorateCommand = decorateCommand;
-exports.isObject = isObject;
-exports.debugOptions = debugOptions;

http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/6436833c/node_modules/couchbulkimporter/node_modules/mongodb/load.js
----------------------------------------------------------------------
diff --git a/node_modules/couchbulkimporter/node_modules/mongodb/load.js b/node_modules/couchbulkimporter/node_modules/mongodb/load.js
deleted file mode 100644
index 01b570e..0000000
--- a/node_modules/couchbulkimporter/node_modules/mongodb/load.js
+++ /dev/null
@@ -1,32 +0,0 @@
-var MongoClient = require('./').MongoClient;
-
-MongoClient.connect('mongodb://localhost:27017/test', function(err, db) {
-  var col = db.collection('test');
-  col.ensureIndex({dt:-1}, function() {
-    var docs = [];
-    for(var i = 0; i < 100; i++) {
-      docs.push({a:i, dt:i, ot:i});
-    }
-    console.log("------------------------------- 0")
-
-    col.insertMany(docs, function() {
-      // Start firing finds
-
-      for(var i = 0; i < 100; i++) {
-        setInterval(function() {
-          col.find({}, {_id: 0, ot:0}).limit(2).sort({dt:-1}).toArray(function(err) {
-            console.log("-------------------------------- 1")
-          });
-        }, 10)
-      }
-
-      // while(true) {
-      //
-      //   // console.log("------------------------------- 1")
-      //   col.find({}, {_id: 0, ot:0}).limit(2).sort({dt:-1}).toArray(function(err) {
-      //     console.log("-------------------------------- 1")
-      //   });
-      // }
-    });
-  });
-});

http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/6436833c/node_modules/couchbulkimporter/node_modules/mongodb/node_modules/es6-promise/CHANGELOG.md
----------------------------------------------------------------------
diff --git a/node_modules/couchbulkimporter/node_modules/mongodb/node_modules/es6-promise/CHANGELOG.md b/node_modules/couchbulkimporter/node_modules/mongodb/node_modules/es6-promise/CHANGELOG.md
deleted file mode 100644
index e06b496..0000000
--- a/node_modules/couchbulkimporter/node_modules/mongodb/node_modules/es6-promise/CHANGELOG.md
+++ /dev/null
@@ -1,9 +0,0 @@
-# Master
-
-# 2.0.0
-
-* re-sync with RSVP. Many large performance improvements and bugfixes.
-
-# 1.0.0
-
-* first subset of RSVP

http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/6436833c/node_modules/couchbulkimporter/node_modules/mongodb/node_modules/es6-promise/LICENSE
----------------------------------------------------------------------
diff --git a/node_modules/couchbulkimporter/node_modules/mongodb/node_modules/es6-promise/LICENSE b/node_modules/couchbulkimporter/node_modules/mongodb/node_modules/es6-promise/LICENSE
deleted file mode 100644
index 954ec59..0000000
--- a/node_modules/couchbulkimporter/node_modules/mongodb/node_modules/es6-promise/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.

http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/6436833c/node_modules/couchbulkimporter/node_modules/mongodb/node_modules/es6-promise/README.md
----------------------------------------------------------------------
diff --git a/node_modules/couchbulkimporter/node_modules/mongodb/node_modules/es6-promise/README.md b/node_modules/couchbulkimporter/node_modules/mongodb/node_modules/es6-promise/README.md
deleted file mode 100644
index ca8678e..0000000
--- a/node_modules/couchbulkimporter/node_modules/mongodb/node_modules/es6-promise/README.md
+++ /dev/null
@@ -1,61 +0,0 @@
-# ES6-Promise (subset of [rsvp.js](https://github.com/tildeio/rsvp.js))
-
-This is a polyfill of the [ES6 Promise](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-constructor). The implementation is a subset of [rsvp.js](https://github.com/tildeio/rsvp.js), if you're wanting extra features and more debugging options, check out the [full library](https://github.com/tildeio/rsvp.js).
-
-For API details and how to use promises, see the <a href="http://www.html5rocks.com/en/tutorials/es6/promises/">JavaScript Promises HTML5Rocks article</a>.
-
-## Downloads
-
-* [es6-promise](https://raw.githubusercontent.com/jakearchibald/es6-promise/master/dist/es6-promise.js)
-* [es6-promise-min](https://raw.githubusercontent.com/jakearchibald/es6-promise/master/dist/es6-promise-min.js)
-
-## Node.js
-
-To install:
-
-```sh
-npm install es6-promise
-```
-
-To use:
-
-```js
-var Promise = require('es6-promise').Promise;
-```
-
-## Usage in IE<9
-
-`catch` is a reserved word in IE<9, meaning `promise.catch(func)` throws a syntax error. To work around this, you can use a string to access the property as shown in the following example.
-
-However, please remember that such technique is already provided by most common minifiers, making the resulting code safe for old browsers and production:
-
-```js
-promise['catch'](function(err) {
-  // ...
-});
-```
-
-Or use `.then` instead:
-
-```js
-promise.then(undefined, function(err) {
-  // ...
-});
-```
-
-## Auto-polyfill
-
-To polyfill the global environment (either in Node or in the browser via CommonJS) use the following code snippet:
-
-```js
-require('es6-promise').polyfill();
-```
-
-Notice that we don't assign the result of `polyfill()` to any variable. The `polyfill()` method will patch the global environment (in this case to the `Promise` name) when called.
-
-## Building & Testing
-
-* `npm run build` to build
-* `npm test` to run tests
-* `npm start` to run a build watcher, and webserver to test 
-* `npm run test:server` for a testem test runner and watching builder

http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/6436833c/node_modules/couchbulkimporter/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise.umd.js
----------------------------------------------------------------------
diff --git a/node_modules/couchbulkimporter/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise.umd.js b/node_modules/couchbulkimporter/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise.umd.js
deleted file mode 100644
index 5984f70..0000000
--- a/node_modules/couchbulkimporter/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise.umd.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import Promise from './es6-promise/promise';
-import polyfill from './es6-promise/polyfill';
-
-var ES6Promise = {
-  'Promise': Promise,
-  'polyfill': polyfill
-};
-
-/* global define:true module:true window: true */
-if (typeof define === 'function' && define['amd']) {
-  define(function() { return ES6Promise; });
-} else if (typeof module !== 'undefined' && module['exports']) {
-  module['exports'] = ES6Promise;
-} else if (typeof this !== 'undefined') {
-  this['ES6Promise'] = ES6Promise;
-}
-
-polyfill();

http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/6436833c/node_modules/couchbulkimporter/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/-internal.js
----------------------------------------------------------------------
diff --git a/node_modules/couchbulkimporter/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/-internal.js b/node_modules/couchbulkimporter/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/-internal.js
deleted file mode 100644
index daee2c3..0000000
--- a/node_modules/couchbulkimporter/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/-internal.js
+++ /dev/null
@@ -1,250 +0,0 @@
-import {
-  objectOrFunction,
-  isFunction
-} from './utils';
-
-import asap from './asap';
-
-function noop() {}
-
-var PENDING   = void 0;
-var FULFILLED = 1;
-var REJECTED  = 2;
-
-var GET_THEN_ERROR = new ErrorObject();
-
-function selfFullfillment() {
-  return new TypeError("You cannot resolve a promise with itself");
-}
-
-function cannotReturnOwn() {
-  return new TypeError('A promises callback cannot return that same promise.');
-}
-
-function getThen(promise) {
-  try {
-    return promise.then;
-  } catch(error) {
-    GET_THEN_ERROR.error = error;
-    return GET_THEN_ERROR;
-  }
-}
-
-function tryThen(then, value, fulfillmentHandler, rejectionHandler) {
-  try {
-    then.call(value, fulfillmentHandler, rejectionHandler);
-  } catch(e) {
-    return e;
-  }
-}
-
-function handleForeignThenable(promise, thenable, then) {
-   asap(function(promise) {
-    var sealed = false;
-    var error = tryThen(then, thenable, function(value) {
-      if (sealed) { return; }
-      sealed = true;
-      if (thenable !== value) {
-        resolve(promise, value);
-      } else {
-        fulfill(promise, value);
-      }
-    }, function(reason) {
-      if (sealed) { return; }
-      sealed = true;
-
-      reject(promise, reason);
-    }, 'Settle: ' + (promise._label || ' unknown promise'));
-
-    if (!sealed && error) {
-      sealed = true;
-      reject(promise, error);
-    }
-  }, promise);
-}
-
-function handleOwnThenable(promise, thenable) {
-  if (thenable._state === FULFILLED) {
-    fulfill(promise, thenable._result);
-  } else if (thenable._state === REJECTED) {
-    reject(promise, thenable._result);
-  } else {
-    subscribe(thenable, undefined, function(value) {
-      resolve(promise, value);
-    }, function(reason) {
-      reject(promise, reason);
-    });
-  }
-}
-
-function handleMaybeThenable(promise, maybeThenable) {
-  if (maybeThenable.constructor === promise.constructor) {
-    handleOwnThenable(promise, maybeThenable);
-  } else {
-    var then = getThen(maybeThenable);
-
-    if (then === GET_THEN_ERROR) {
-      reject(promise, GET_THEN_ERROR.error);
-    } else if (then === undefined) {
-      fulfill(promise, maybeThenable);
-    } else if (isFunction(then)) {
-      handleForeignThenable(promise, maybeThenable, then);
-    } else {
-      fulfill(promise, maybeThenable);
-    }
-  }
-}
-
-function resolve(promise, value) {
-  if (promise === value) {
-    reject(promise, selfFullfillment());
-  } else if (objectOrFunction(value)) {
-    handleMaybeThenable(promise, value);
-  } else {
-    fulfill(promise, value);
-  }
-}
-
-function publishRejection(promise) {
-  if (promise._onerror) {
-    promise._onerror(promise._result);
-  }
-
-  publish(promise);
-}
-
-function fulfill(promise, value) {
-  if (promise._state !== PENDING) { return; }
-
-  promise._result = value;
-  promise._state = FULFILLED;
-
-  if (promise._subscribers.length !== 0) {
-    asap(publish, promise);
-  }
-}
-
-function reject(promise, reason) {
-  if (promise._state !== PENDING) { return; }
-  promise._state = REJECTED;
-  promise._result = reason;
-
-  asap(publishRejection, promise);
-}
-
-function subscribe(parent, child, onFulfillment, onRejection) {
-  var subscribers = parent._subscribers;
-  var length = subscribers.length;
-
-  parent._onerror = null;
-
-  subscribers[length] = child;
-  subscribers[length + FULFILLED] = onFulfillment;
-  subscribers[length + REJECTED]  = onRejection;
-
-  if (length === 0 && parent._state) {
-    asap(publish, parent);
-  }
-}
-
-function publish(promise) {
-  var subscribers = promise._subscribers;
-  var settled = promise._state;
-
-  if (subscribers.length === 0) { return; }
-
-  var child, callback, detail = promise._result;
-
-  for (var i = 0; i < subscribers.length; i += 3) {
-    child = subscribers[i];
-    callback = subscribers[i + settled];
-
-    if (child) {
-      invokeCallback(settled, child, callback, detail);
-    } else {
-      callback(detail);
-    }
-  }
-
-  promise._subscribers.length = 0;
-}
-
-function ErrorObject() {
-  this.error = null;
-}
-
-var TRY_CATCH_ERROR = new ErrorObject();
-
-function tryCatch(callback, detail) {
-  try {
-    return callback(detail);
-  } catch(e) {
-    TRY_CATCH_ERROR.error = e;
-    return TRY_CATCH_ERROR;
-  }
-}
-
-function invokeCallback(settled, promise, callback, detail) {
-  var hasCallback = isFunction(callback),
-      value, error, succeeded, failed;
-
-  if (hasCallback) {
-    value = tryCatch(callback, detail);
-
-    if (value === TRY_CATCH_ERROR) {
-      failed = true;
-      error = value.error;
-      value = null;
-    } else {
-      succeeded = true;
-    }
-
-    if (promise === value) {
-      reject(promise, cannotReturnOwn());
-      return;
-    }
-
-  } else {
-    value = detail;
-    succeeded = true;
-  }
-
-  if (promise._state !== PENDING) {
-    // noop
-  } else if (hasCallback && succeeded) {
-    resolve(promise, value);
-  } else if (failed) {
-    reject(promise, error);
-  } else if (settled === FULFILLED) {
-    fulfill(promise, value);
-  } else if (settled === REJECTED) {
-    reject(promise, value);
-  }
-}
-
-function initializePromise(promise, resolver) {
-  try {
-    resolver(function resolvePromise(value){
-      resolve(promise, value);
-    }, function rejectPromise(reason) {
-      reject(promise, reason);
-    });
-  } catch(e) {
-    reject(promise, e);
-  }
-}
-
-export {
-  noop,
-  resolve,
-  reject,
-  fulfill,
-  subscribe,
-  publish,
-  publishRejection,
-  initializePromise,
-  invokeCallback,
-  FULFILLED,
-  REJECTED,
-  PENDING
-};