function _applyConnectionUpdatesPreValidation(connection, updates) {
  return new Promise((resolve) => {
    if ('name' in updates) connection.name = updates.name;
    if ('host' in updates) {
      connection.host = updates.host;
      delete connection.replicaSet;
      if (mongoUtils.isLocalHost(updates.host)) {
        delete connection.databases;
      }
    }
    if ('port' in updates) connection.port = updates.port;
    if ('databaseName' in updates) connection.databaseName = updates.databaseName;
    if ('auth' in updates) {
      if (!updates.auth) delete connection.auth; //null or undefined so remove it
      else if (connection.auth) {
        if ('username' in updates.auth) connection.auth.username = updates.auth.username;
        if ('password' in updates.auth) connection.auth.password = updates.auth.password;
      } else {
        connection.auth = updates.auth;
      }
    }
    if ('replicaSet' in updates) {
      if (!updates.replicaSet) delete connection.replicaSet; //null or undefined so remove it
      else if (connection.replicaSet) {
        delete connection.host;
        delete connection.port;
        if ('name' in updates.replicaSet) connection.replicaSet.name = updates.replicaSet.name;
        if ('servers' in updates.replicaSet) connection.replicaSet.servers = updates.replicaSet.servers;
      } else {
        connection.replicaSet = updates.replicaSet;
      }
    }

    if (!mongoUtils.isLocalHost(connection.host)) {
      let db = connection.databases && connection.databases.length ? connection.databases[0] : null;

      if (!db) logger.warn('connection service - _applyConnectionUpdates() - connection has no database');
      else {
        if (!connection.databaseName) connection.databaseName = db.name;
        let auth = db.auth;
        if (connection.auth) {
          connection.auth.username = connection.auth.username || (auth ? auth.username : null);
          connection.auth.password = connection.auth.password || (auth ? auth.password : null);
        }
      }
    }

    return resolve(connection);
  });
}
Validate updates to a connection
@param {Connection} connection - connection instance
@param {object} updates - hash of updates to apply to validate
@private