@Deprecated
    public WriteResult addUser(final String userName, final char[] password, final boolean readOnly) {
        MongoCredential credential = createCredential(userName, getName(), password);
        boolean userExists = false;
        try {
            userExists = executor.execute(new com.mongodb.operation.UserExistsOperation(getName(), userName), primary(), getReadConcern());
        } catch (MongoCommandException e) {
            if (e.getCode() != 13) {
                throw e;
            }
        }
        try {
            if (userExists) {
                executor.execute(new com.mongodb.operation.UpdateUserOperation(credential, readOnly, getWriteConcern()), getReadConcern());
                return new WriteResult(1, true, null);
            } else {
                executor.execute(new com.mongodb.operation.CreateUserOperation(credential, readOnly, getWriteConcern()), getReadConcern());
                return new WriteResult(1, false, null);
            }
        } catch (MongoWriteConcernException e) {
            throw createWriteConcernException(e);
        }
    }
@Deprecated
    public WriteResult addUser(final String userName, final char[] password, final boolean readOnly) {
        MongoCredential credential = createCredential(userName, getName(), password);
        boolean userExists = false;
        try {
            userExists = executor.execute(new com.mongodb.operation.UserExistsOperation(getName(), userName), primary(), getReadConcern());
        } catch (MongoCommandException e) {
            if (e.getCode() != 13) {
                throw e;
            }
        }
        try {
            if (userExists) {
                executor.execute(new com.mongodb.operation.UpdateUserOperation(credential, readOnly, getWriteConcern()), getReadConcern());
                return new WriteResult(1, true, null);
            } else {
                executor.execute(new com.mongodb.operation.CreateUserOperation(credential, readOnly, getWriteConcern()), getReadConcern());
                return new WriteResult(1, false, null);
            }
        } catch (MongoWriteConcernException e) {
            throw createWriteConcernException(e);
        }
    }
@ Deprecated public WriteResult addUser ( final String userName , final char [ ] password , final boolean readOnly ) { MongoCredential credential = createCredential ( userName , getName ( ) , password ) ; boolean userExists = false ; try { userExists = executor . execute ( new com . mongodb . operation . UserExistsOperation ( getName ( ) , userName ) , primary ( ) , getReadConcern ( ) ) ; } catch ( MongoCommandException e ) { if ( e . getCode ( ) != 13 ) { throw e ; } } try { if ( userExists ) { executor . execute ( new com . mongodb . operation . UpdateUserOperation ( credential , readOnly , getWriteConcern ( ) ) , getReadConcern ( ) ) ; return new WriteResult ( 1 , true , null ) ; } else { executor . execute ( new com . mongodb . operation . CreateUserOperation ( credential , readOnly , getWriteConcern ( ) ) , getReadConcern ( ) ) ; return new WriteResult ( 1 , false , null ) ; } } catch ( MongoWriteConcernException e ) { throw createWriteConcernException ( e ) ; } }
Adds or updates a user for this database

<p>Never create or modify users over an insecure network without the use of TLS.</p>
@param userName the user name
@param password the password
@param readOnly if true, user will only be able to read
@return the result of executing this operation
@throws MongoException if the operation failed
@mongodb.driver.manual administration/security-access-control/  Access Control
@mongodb.driver.manual reference/command/createUser createUser
@mongodb.driver.manual reference/command/updateUser updateUser
@deprecated Use {@code DB.command} to call either the createUser or updateUser command
Adds or updates a user for this database