private static MongoDatabaseFactory mongoDbFactory(final MongoClient mongo, final BaseMongoDbProperties props) {
        if (StringUtils.isNotBlank(props.getDatabaseName())) {
            return new SimpleMongoClientDatabaseFactory(mongo, props.getDatabaseName());
        }
        val connectionString = new ConnectionString(props.getClientUri());
        return new SimpleMongoClientDatabaseFactory(mongo, Objects.requireNonNull(connectionString.getDatabase()));
    }
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