0

I am using mongock, all migration correctly pass, bun when invoke mongoTemplate.updateMulti then throw an

Caused by: java.lang.AbstractMethodError: Method com/github/cloudyrock/mongock/driver/mongodb/springdata/v3/decorator/impl/MongockTemplate.updateMulti(Lorg/springframework/data/mongodb/core/query/Query;Lorg/springframework/data/mongodb/core/query/Update;Ljava/lang/String;)Lcom/mongodb/client/result/UpdateResult; is abstract
    at com.github.cloudyrock.mongock.driver.mongodb.springdata.v3.decorator.impl.MongockTemplate.updateMulti(MongockTemplate.java)
private void updateSpecifiedCollection(MongockTemplate mongoTemplate, String collectionName) {
    Update updateQuery = Update.update("photo_width", 1920).set("photo_height", 1080);
    mongoTemplate.updateMulti(Query.query(Criteria.where("camera.serial_number")
            .is("1f3417b7-ccbf-4367-bba2-540d555ce11c").and("photo_date").gt(Instant.parse("2018-06-25T13:54:00Z"))),
        updateQuery, collectionName);

i am expecting it will rename specified name.

1 Answers1

0

The problem you are experimenting is that, for the Mongock version you are using, MongockTemplate(which is a deprecated wrapper for MongoTemplate) is not using the same version of MongoTemplate you are importing.

Instead of fixing the MongockTemplate, we highly recommend upgrading to Mongock 5.x.x, and use directly MongoTemplate.

Upgrading from version 4 to 5 is an easy process, but you have this guide

Mongock team
  • 1,188
  • 5
  • 9