Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
spring-projects-issues opened this issue Mar 4, 2014 · 18 comments
Assignees
Labels
in: core Issues in core support type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link

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
Copy link
Author

Martin Baumgartner commented

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

@spring-projects-issues
Copy link
Author

Arulraj V commented

Any update on this...?

@spring-projects-issues
Copy link
Author

shollander commented

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

@spring-projects-issues
Copy link
Author

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

@PedroEsnaola
Copy link

PedroEsnaola commented Aug 31, 2021

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

@kubawell
Copy link

this bug is fixed now ?

@mahdibohloul
Copy link

Any update about this issue?

@kliarist
Copy link

any news on this ?

@ajax-semenov-y
Copy link

any updates?

@Leon-Shaw
Copy link

any news?

@MirAbgarAbrahamyan
Copy link

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

@PixelBumper
Copy link

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?

@hockyy
Copy link

hockyy commented Jun 16, 2023

up

@jmuniyappan
Copy link

any update please ?

@jonymusky
Copy link

up

@Liveitabhi14
Copy link

any updates ?

@ajax-siukhin-a
Copy link

up

@grassehh
Copy link

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

So, what is the workaround ??
In my project, we benefit from the atomicity of the findAndModify operation because converter is not used when inserting a new document.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core support type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests