Skip to content

Commit fec7754

Browse files
christophstroblschauder
authored andcommitted
Mention java.util.Date _id to ObjectId conversion.
See #5092 See #5078 Original pull request #5080
1 parent 67d648b commit fec7754

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/main/antora/modules/ROOT/pages/mongodb/template-crud-operations.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ When you use the `MappingMongoConverter`, certain rules govern how properties fr
191191
The following outlines what type conversion, if any, is done on the property mapped to the `_id` document field when using the `MappingMongoConverter` (the default for `MongoTemplate`).
192192

193193
. If possible, an `id` property or field declared as a `String` in the Java class is converted to and stored as an `ObjectId` by using a Spring `Converter<String, ObjectId>`. Valid conversion rules are delegated to the MongoDB Java driver. If it cannot be converted to an `ObjectId`, then the value is stored as a string in the database.
194+
. An `id` property or field declared as `Date` is converted to and stored as `ObjectId`.
194195
. An `id` property or field declared as `BigInteger` in the Java class is converted to and stored as an `ObjectId` by using a Spring `Converter<BigInteger, ObjectId>`.
195196

196197
If no field or property specified in the previous sets of rules is present in the Java class, an implicit `_id` file is generated by the driver but not mapped to a property or field of the Java class.

0 commit comments

Comments
 (0)