Comments (5)
Sorry for the inconvenience but this is actually the expected behaviour for fields that are present in the raw document. In the above you'd have to $unset
fields.
from spring-data-mongodb.
Thank you for your quick response! I can see that this intuitively makes sense (actual data in DB has precedence over default values). But I was still wondering about the change in behaviour after SB >=v3.2.0 (SpringDataMongoDB >=4.2.0).
It seems that in older versions, 'null' values did in fact not overwrite default values.
from spring-data-mongodb.
Right, that one should have made it into the release notes on the wiki page. The Mapping section in the documentation contains an extra note that explains the current behaviour.
from spring-data-mongodb.
This change exposes us to all sorts of possible nullPointers. Is there a way we can change this behaviour for collections (see highlighted part in screenshot). A custom converter would not be the right tool, since we actually don't want to convert at all?
![image](https://private-user-images.githubusercontent.com/2951619/304672795-78e76cc6-6efc-43f8-88bb-2cbd447a1205.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkwNzk4NDcsIm5iZiI6MTcxOTA3OTU0NywicGF0aCI6Ii8yOTUxNjE5LzMwNDY3Mjc5NS03OGU3NmNjNi02ZWZjLTQzZjgtODhiYi0yY2JkNDQ3YTEyMDUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYyMiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MjJUMTgwNTQ3WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ODkyMDgxNzRiYzY5YWU3ZmFkNWQyMDM4NjUzM2EyODc0MDNmZjlmMjIzODgwZjIyMDIyM2U4ZDMxNjZmYjViYSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.UdtdeE0d_W4ah5VifI_OAVaQVariwz1zEy3_tI6SVpk)
from spring-data-mongodb.
@n0daft you could use Lifecycle Events to post process types after conversion.
from spring-data-mongodb.
Related Issues (20)
- Behavior of `$project` for nested documents HOT 1
- Use of arrayFilters in @Update in mongo repository HOT 1
- VectorSearch Aggregation Stage HOT 1
- Id conversion handling in `QueryMapper.getMappedValue(…)` doesn't consider nesting HOT 1
- Can't create CRaC checkpoint, fails with the error message "Restarting Spring-managed lifecycle beans after JVM restore" HOT 2
- `SpringDataMongodbQuery` and `SpringDataMongodbSerializer` apply mapping twice HOT 1
- Null-Values from custom converters are stored in document HOT 1
- SpringApplication.exit(...) not closing application due to MongoDB locks for cluster with multiple nodes
- Converter called multiple times evaluating aggregation operation query methods HOT 5
- Creating a Type-Safe Query with Kotlin for Document IDs that have a relationship with DBRef HOT 2
- Aggregation with `$unwind` and `$project` causes `IllegalArgumentException` HOT 1
- Support derived queries using the same field multiple times HOT 1
- querydsl predicate using IN operator returns no results with @DBRef HOT 2
- Aggregation pipeline breaks if $replaceRoot stage is present HOT 2
- Misleading Change Streams documentation HOT 2
- Release 4.2.8 (2023.1.8)
- Release 4.3.2 (2024.0.2)
- MongoTemplate.count Specify strategy HOT 2
- Unable to Determine Generic Converter type HOT 1
- Switch to Broadcom docker proxy
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.