Module spring.data.mongodb
Annotation Interface MongoId
MongoId represents a MongoDB specific Id annotation that allows customizing id conversion.
Id properties use FieldType.IMPLICIT as the default
id's target type. This means that the actual property value is used. No conversion attempts to any other
type are made. In contrast to
@Id, String id's are stored as the such even when the actual value
represents a valid ObjectId hex String. To trigger String to
ObjectId conversion use @MongoId(FieldType.OBJECT_ID).- Since:
- 2.2
- Author:
- Christoph Strobl, Mark Paluch
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionGet the preferred _id type to be used.
-
Element Details
-
value
- Returns:
- the preferred id type.
- See Also:
- Default:
- IMPLICIT
-
targetType
Get the preferred _id type to be used. Defaults toFieldType.IMPLICITwhich uses the property's type. If defined different, the given value is attempted to be converted into the desired target type viaMongoConverter.convertId(Object, Class).- Returns:
- the preferred id type.
FieldType.IMPLICITby default.
- Default:
- IMPLICIT
-