@Field @Retention(value=RUNTIME) @Target(value={FIELD,METHOD,ANNOTATION_TYPE}) public @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. @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).| Modifier and Type | Optional Element and Description |
|---|---|
FieldType |
targetType
Get the preferred _id type to be used.
|
FieldType |
value |
@AliasFor(annotation=Field.class, attribute="targetType") public abstract FieldType value
targetType()@AliasFor(annotation=Field.class, attribute="targetType") public abstract FieldType targetType
FieldType.IMPLICIT which uses the property's
type. If defined different, the given value is attempted to be converted into the desired target type via
MongoConverter.convertId(Object, Class).FieldType.IMPLICIT by default.Copyright © 2011–2019 Pivotal Software, Inc.. All rights reserved.