Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mongotemplate.updateFirst() doesn't update @LastModifiedDate

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

like image 663
Srini Kandula Avatar asked Jan 26 '26 16:01

Srini Kandula


1 Answers

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

like image 116
Yevhenii Semenov Avatar answered Jan 29 '26 06:01

Yevhenii Semenov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!