📜
En2Do
  • En2Do
  • Get Started
    • Add as dependency
    • Create the MongoManager
      • MongoManager and ExecutorService
    • Create an Entity
      • Entities without lombok
    • Create the Repository
    • Packing all together
  • METHODS
    • Predefined methods
    • Method keywords
    • Filter keywords
    • AsyncRepository
  • Repository Options
    • What are Repository Options?
    • SeparateEntityId
    • DropEntitiesOnStart
    • DropIndexesOnStart
    • AppendMethodAsComment
  • Usage
    • Sorting
      • Sorting by Annotation
      • Sorting by Parameter
    • Pagination
    • Index
      • Identifier Index
      • Compound Index (Multi-Field-Index)
      • TTL Index
    • Transform
    • Transient
    • TransformField
    • Async
    • UpdateBatch
Powered by GitBook
On this page
  1. Usage

TransformField

Renaming fields in Documents.

PreviousTransientNextAsync

Last updated 2 years ago

CtrlK

You can transform not only method names with en2do, but also field names. More precisely, the names of the fields in the MongoDB document. This is made possible by the @TransformField method.

Example of @TransformField usage:

// Lombok's annotations go here.. 
public class Customer {

    @Id // en2do
    UUID uniqueId;

    // Other fields go here...

    @TransformField("otherField") // en2do - Change field name to "otherField"
    String reallyLongFieldName;
}