MongoDB Projection on embedded document field with mongoTemplate
问题 In my java application i want retrieve a field of an embedded document. This is my pojo: My User.class public class User implements Comparable<User> { @Id private String username; private String ownerFirstname; private String ownerLastname; @DBRef @CascadeSave @JsonInclude(JsonInclude.Include.NON_NULL) private Role role; } Role.class @Document @JsonDeserialize(using = RoleDeserializer.class) public interface Role { String getId(); void setId(String id); } Society.class @Document(collection =