Module spring.data.mongodb
Annotation Interface Field
Annotation to define custom metadata for document fields.
- Author:
- Oliver Gierke, Christoph Strobl, Divya Srivastava
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnumeration of write strategies to define when a property is included for write conversion. -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionThe key to be used to store the field inside the document.intThe order in which various fields shall be stored.The actual desired target type the field should be stored as.The key to be used to store the field inside the document.Write rules when to include a property value upon conversion.
-
Element Details
-
value
The key to be used to store the field inside the document. Alias forname().- Default:
- ""
-
name
The key to be used to store the field inside the document. Alias forvalue(). The name may contain MongoDB special characters like dot (.). In this case the name is by default treated as apath. To preserve dots within the name set thenameType()attribute toFieldName.Type.KEY.- Returns:
- an empty
Stringby default. - Since:
- 2.2
- Default:
- ""
-
nameType
FieldName.Type nameType- Returns:
FieldName.Type.PATHby default.- Since:
- 4.2
- Default:
- PATH
-
order
int orderThe order in which various fields shall be stored. Has to be a positive integer.- Returns:
- the order the field shall have in the document or -1 if undefined.
- Default:
- 2147483647
-
targetType
FieldType targetTypeThe actual desired target type the field should be stored as.- Returns:
FieldType.IMPLICITby default.- Since:
- 2.2
- Default:
- IMPLICIT
-
write
Field.Write writeWrite rules when to include a property value upon conversion. If set toField.Write.NON_NULL(default) null values are not written to the targetDocument. Setting the value toField.Write.ALWAYSexplicitly adds an entry for the given field holding null as a value'fieldName' : null.
NOTE: Setting the value toField.Write.ALWAYSmay lead to increased document size.- Returns:
Field.Write.NON_NULLby default.- Since:
- 3.3
- Default:
- NON_NULL
-