Comments (3)
Auditing fields are updated in AuditingEntityCallback
which is a BeforeConvertCallback
. Using a BeanPostProcessor
(or registering infrastructure beans yourself), you could wrap AuditingEntityCallback
in your own callback and apply auditing based on the object/collection yourself.
Alternatively, you can convert the object into Document
using MongoConverter
and insert the resulting Document
via MongoTemplate.insert(…)
to bypass any model-specific actions that would be otherwise in place if you passed the original object into MongoTemplate.insert(…)
.
Let me know whether this helps.
from spring-data-mongodb.
Thanks for the reply!
I honestly do not view implementing our own BeanPostPrcoessor
and callback wrapping as an easy solution. That is doable, I understand, but it seems that framework can hide this complexity.
Converting an entity to a Document
is not that great since we seem to lose other things like callbacks for given entity (not for Document
), version inspection etc.
So, I personally think that this is more like a workaround, but not a solution.
from spring-data-mongodb.
We never intended to have conditional auditing hence there's no other way to make auditing conditional. As we do not plan on adding such a feature, I'm closing the ticket.
from spring-data-mongodb.
Related Issues (20)
- Problem with replacement of @DBRef to @DocumentReference HOT 2
- AggregationResults include documents outside the MatchOperation when there is a MergeOperation present HOT 3
- Can't use properties in `@Indexed#expireAfter` HOT 1
- Align OffsetScrolling to zero-based indexes
- Criteria.regex is converted to String when applying to ID fields HOT 4
- Index creation not working in combination with multi tenancy HOT 3
- Adding `SECONDARY_READS` meta flag to the query does not affect the `readPreference` HOT 2
- Add support for value expressions in repository query methods
- Upgrade to MongoDB 5.0.1 driver
- Upgrade to MongoDB 4.11.2 driver HOT 1
- Allow creating time series collections with custom name and CollectionOptions derived from annotation HOT 2
- Criteria.getCriteriaObject invalid when using Criteria.expr HOT 4
- Add a debug information for sort fields when using findByQuery
- Aggregation criteria match mapping fails with `NullPointerException` HOT 4
- Release 4.1.12 (2023.0.12)
- Release 4.2.6 (2023.1.6)
- Release 4.3 GA (2024.0.0)
- Regex criteria is not mapped to mongo query
- Aggregation/Aggregation Operations - equals() function is missing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-data-mongodb.