I'm using spring-data-mongodb and have a simple repository which is configured with the following configuration:
@Configuration
@EnableMongoRepositories(basePackages = "com.my.package")
@Profile("default")
public class MongoConfig extends AbstractMongoConfiguration {
@Value("${mongo.db.uri}")
private String mongoDbUri;
@Value("${mongo.db.database}")
private String mongoDbDatabaseName;
@Override
protected String getDatabaseName() {
return mongoDbDatabaseName;
}
@Override
public MongoClient mongoClient() {
return new MongoClient(new MongoClientURI(mongoDbUri));
}
}
The used repository extends the CrudRepository, which makes that I can call the saveAll() method. By default, doing a saveAll (bulk operation) in mongodb will stop when one record fails, unless an option was passed to the insertMany/updateMany command to have "continueOnError" to true or have "BulkMode.unordered". Is there any way I can configure spring data to always continue on error (or always do an unordered insert/update), so that doing a saveAll will always try the whole bulk, even if some records fail?
Thanks!