@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用户
[
{
"id": "5922bccbbba56342fc55a73f",
"group": {
"id": "5922bccbbba56342fc55a73d",
"code": "ROLE_ADMIN",
"target": {
"id": "5922bccbbba56342fc55a73d",
"code": "ROLE_ADMIN"
}
},
}
]
问题是我在json中获得了一些目标属性,而这在课堂上并不存在。有什么想法吗?
更新:DbRef(lazy = true) add the target attribute