private static MongoCredential buildMongoCredential(final BaseMongoDbProperties mongo) {
        val dbName = StringUtils.defaultIfBlank(mongo.getAuthenticationDatabaseName(), mongo.getDatabaseName());
        return MongoCredential.createCredential(mongo.getUserId(), dbName, mongo.getPassword().toCharArray());
    }
Remove any index with the same indexKey but differing indexOptions in anticipation of recreating it.

@param mongoTemplate   the mongo template
@param collection      The collection to check the indexes of
@param indexesToCreate the indexes to create
support/cas-server-support-mongo-core/src/main/java/org/apereo/cas/mongo/MongoDbConnectionFactory.java