Skip to content

Support nested level projections through interface-based projection [DATAMONGO-1989] #2860

Closed
@spring-projects-issues

Description

@spring-projects-issues

Dennis Nijssen opened DATAMONGO-1989 and commented

It would be great to support nested level projections through interfaces. Given a closed projection with a nested class, we would be able to support nested fields.

The document / collection class:

@Document
public class Person {

    private String firstName;
    private String lastName;
    private Address address;

    static class Address {

        private String zipCode, city;

        // getters and setters
    }

    // getters and setters
}

The closed projection interface:

public interface PersonSummary {

    String getFirstName();

    AddressSummary getAddress();

    interface AddressSummary {

        String getCity();
    }
}

Actual "fields" outcome right now:

fields: Document`firstName=1, address=1`

Expected "fields" outcome:

fields: Document`firstName=1, address.city=1`

 


Reference URL: https://stackoverflow.com/questions/50487231/spring-data-mongodb-interface-based-projection-recursively

1 votes, 2 watchers

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions