spring-data-mongodb icon indicating copy to clipboard operation
spring-data-mongodb copied to clipboard

update* and findAndModify methods do not update audit fields. [DATAMONGO-869]

Open spring-projects-issues opened this issue 10 years ago • 18 comments

Poorna Subhash opened DATAMONGO-869 and commented

DATAMONGO-811 addressed the update of @Version field.

But both update* and findAndModify methods lack in updating audit fields @CreatedBy, @LastModifiedBy, @CreatedDate, @LastModifiedDate .

Currently I am using workaround by writing aspects on MongoTemplate methods. Explained here http://poornasubhash.blogspot.in/2013/06/spring-mongodb-auditing-and-extensions.html.

It would be nice if this is included as part of framework.


Issue Links:

  • DATAMONGO-1482 Auditing annotations does not work when updated using MongoTemplate ("is duplicated by")
  • DATAMONGO-2317 Auditing field not updated when object updated using update ("is duplicated by")

3 votes, 7 watchers

spring-projects-issues avatar Mar 04 '14 03:03 spring-projects-issues

Martin Baumgartner commented

The problem: MongoTemplate's doFindAndUpdate(..) and doUpdate(..) don't have listeners yet.

spring-projects-issues avatar Mar 09 '14 14:03 spring-projects-issues

Arulraj V commented

Any update on this...?

spring-projects-issues avatar Apr 25 '18 00:04 spring-projects-issues

shollander commented

This ticket is over five years old and still hasn't been fixed! Please fix, thanks!

spring-projects-issues avatar Jul 12 '19 04:07 spring-projects-issues

Mark Paluch commented

Auditing is applied only when working with entities directly via IsNewAwareAuditingHandler and not for query-based/bulk updates. Query-based updates require an association to an entity type, updates using just a collection name cannot participate in auditing updates

spring-projects-issues avatar Jul 12 '19 09:07 spring-projects-issues

My Auditing fields aren't setted even if entity class is passed on method

image image the updatedAt is setted during document creation, because i call the ReactiveMongoReposiroty method save() but when using reactive mongo template updateFirst or findAndModify with entity class, it doesn't work properly

Spring Boot Version 2.2.6.RELEASE Spring data mongodb reactive Version: 2.2.6.RELEASE

PedroEsnaola avatar Aug 31 '21 13:08 PedroEsnaola

this bug is fixed now ?

kubawell avatar Feb 15 '22 08:02 kubawell

Any update about this issue?

mahdibohloul avatar May 21 '22 07:05 mahdibohloul

any news on this ?

kliarist avatar Aug 26 '22 08:08 kliarist

any updates?

ajax-semenov-y avatar Sep 30 '22 15:09 ajax-semenov-y

any news?

Leon-Shaw avatar Oct 11 '22 08:10 Leon-Shaw

Is this going to be fixed? It is very uncomfortable without this feature.

MirAbgarAbrahamyan avatar Oct 18 '22 12:10 MirAbgarAbrahamyan

I would love to help fixing this. As far as I have understood some callbacks are missing. Am I on the right track when looking at maybeCallBeforeConvert&maybeCallBeforeSave?

PixelBumper avatar Nov 21 '22 21:11 PixelBumper

up

hockyy avatar Jun 16 '23 04:06 hockyy

any update please ?

jmuniyappan avatar Aug 15 '23 20:08 jmuniyappan

up

jonymusky avatar Sep 14 '23 14:09 jonymusky

any updates ?

Liveitabhi14 avatar Jan 24 '24 11:01 Liveitabhi14