driver-core/src/main/com/mongodb/MongoCredential.java
public <T> MongoCredential withMechanismProperty(final String key, final T value) {
        return new MongoCredential(this, key, value);
    }
public <T> MongoCredential withMechanismProperty(final String key, final T value) {
        return new MongoCredential(this, key, value);
    }
Creates a new MongoCredential as a copy of this instance, with the specified mechanism property added.

@param key   the key to the property, which is treated as case-insensitive
@param value the value of the property
@param <T>   the property type
@return the credential
@since 2.12