0
@Document("user")
public class User
  @Id
  String id;

  @DbRef(lazy=true)
  Group group;
}


@Document("Group")
public class Group{
  @Id
  private String Id;

  private string code;
}

JSON User

[
  {
    "id": "5922bccbbba56342fc55a73f",
    "group": {
      "id": "5922bccbbba56342fc55a73d",
      "code": "ROLE_ADMIN",
      "target": {
        "id": "5922bccbbba56342fc55a73d",
        "code": "ROLE_ADMIN"
      }
    },

  }
]

Problem is i am getting some target attribute in json which is not there in class. Any idea ?

Update : DbRef(lazy = true) add the target attribute

Saurabh Kumar
  • 16,353
  • 49
  • 133
  • 212

0 Answers0