I'm using annotation based configuration.
@Configuration
@Profile("default")
@ComponentScan(basePackages = "com.*")
@EnableMongoRepositories
@EnableMongoAuditing
public class ApplicationDataConfig ....
And I also have @LastModifiedDate, @CreatedDate annotation set on fields of type org.joda.time.DateTime. When I use
org.springframework.data.mongodb.repository.MongoRepository.save(entity)
both the audit fields are updated just fine. But when I use
org.springframework.data.mongodb.core.MongoTemplate.updateFirst()/updateMulti()
the lastupdated time is not being updated. Does anybody have a clue of what could be wrong? I'm using spring-data-mongodb1.8.3
Unfortunately, this is not supported now. There is a ticket so you can track progress: https://github.com/spring-projects/spring-data-mongodb/issues/1797
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With