Document list/map/set initialization on read.

Update the reference documentation about collection initialization on read, add the required tests to make sure it behaves as expected and simplify BeanUtils value presence check.

Closes #4571
Original pull request: #4574
This commit is contained in:
Christoph Strobl
2023-11-30 10:16:04 +01:00
committed by Mark Paluch
parent fa9fbcb2ed
commit e5b9f7d455
3 changed files with 90 additions and 1 deletions

View File

@@ -274,6 +274,17 @@ calling `get()` before the actual conversion
|===
====
.Collection Handling
[NOTE]
====
Collection handing depends on the actual values retrieved from the MongoDB.
* If a document does **not** contain the field mapped to a collection, the mapping will not touch the property.
Which means the value will remain `null`, a java default or any value set during object creation.
* If the document contains the field to be mapped, but the field holds a `null` value (like: `{ 'list' : null }`), the property value is set to `null` overriding any default value set during object creation.
* If the document contains the field to be mapped to a collection which is **not** `null` (like: `{ 'list' : [ ... ] }`), the collection is populated with the mapped values overriding any default value set during object creation.
====
[[mapping-configuration]]
== Mapping Configuration