Responsive Ad Area

Share This Post

test

Is there a way to avoid index creation on application startup using Mongo repository?

JaversBuilder.build() always calls MongoRepository.ensureSchema() to execute createIndex() for jv_snapshots, even when the indexes already exists.

Particularly, the createIndex permission was revoked because this command blocks all other operations on the Mongo instance (not only the database, like in MongoDB documentation) when executed in foreground.

Maybe ensureSchema could be called when configuring Javers for the application, outside JaversBuilder.build(). Example:

@Bean
public Javers javers() {
    MongoRepository repository = new MongoRepository(mongoClient.getDatabase(databaseName));
    Javers javers = JaversBuilder.javers().registerJaversRepository(repository).build();
    repository.ensureSchema();
    return javers;
}

It is appropriate to suggest the removal of the call to ensureSchema from JaversBuilder.build() or is there another way to avoid index creation on startup in a non Spring Boot application?


Is there a way to avoid index creation on application startup using Mongo repository?
Is there a way to avoid index creation on application startup using Mongo repository?
test
{$excerpt:n}

Share This Post

Leave a Reply

Your email address will not be Publishedd. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Skip to toolbar