morphia icon indicating copy to clipboard operation
morphia copied to clipboard

Mapping nested objects to property using dot notation

Open kevbradwick opened this issue 8 years ago • 1 comments

Hello,

This is a feature request.

When mapping documents to POJO's, it would be nice to use the @Property annotation to map nested documents using dot notation. For example;

Document

{
    name: "morphia",
    meta: {
        version: "1.1.1"
   }
}

POJO

class Document {

    private String name;

    @Property("meta.version")
    private String version;
}

This would avoid having to model deeply nested documents with a lot of boilerplate code.

kevbradwick avatar Aug 15 '16 10:08 kevbradwick

~~+1~~

Edit: @kevbradwick: If you haven't already, I think you might want to look into the Embedded Annotation It's not as "slim" as using dot-notation, but it's definitely cleaner and less brittle to provide proper abstractions for nested documents.

frhd avatar Dec 12 '17 13:12 frhd