code: function getMongooseConnection(uri, mongooseConnection, cb) {
    logger.debug("getting mongoose connection");
    var mongooseConn;
    if (mongooseConnection && typeof mongooseConnection.useDb === 'function') {
      process.nextTick(function() {
        logger.debug("creating the mongoose connection using the existing connection", {uri: uri});
        var dbName = getDbName(uri);
        mongooseConn = mongooseConnection.useDb(dbName);
        return cb(undefined, mongooseConn);
      });
    } else {
      process.nextTick(function() {
        logger.warn("creating a new mongoose connection", {uri: uri});
        mongooseConn = mongoose.createConnection(uri);
        return cb(undefined, mongooseConn);
      });
    }
  }
docs: Get a new mongoose connection instance. Will reuse an existing mongoose connection if it's passed in (this connection should be authenticated already and have access to the target db. E.g. admin user).
  Otherwise a new mongoose connection (connection pool) will be created.
  @param {string} url the uri of the mongodb
  @param {object} mongooseConnection an existing mongoose connection. If exists, it will be resued for the mongoose connection
  @param {function} cb the callback function