You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Copy file name to clipboardExpand all lines: spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/MappingMongoConverterUnitTests.java
Copy file name to clipboardExpand all lines: src/main/antora/modules/ROOT/pages/mongodb/mapping/mapping.adoc
+11
Original file line number
Diff line number
Diff line change
@@ -274,6 +274,17 @@ calling `get()` before the actual conversion
274
274
|===
275
275
====
276
276
277
+
.Collection Handling
278
+
[NOTE]
279
+
====
280
+
Collection handing depends on the actual values retrieved from the MongoDB.
281
+
282
+
* If a document does **not** contain the field mapped to a collection, the mapping will not touch the property.
283
+
Which means the value will remain `null`, a java default or any value set during object creation.
284
+
* 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.
285
+
* 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.
0 commit comments