我认为您的 JSON 模型看起来像这样。
[
{
"name": "items",
"fields": {
"name": {
"type": "string"
},
"description": {
"type": "text"
},
"user": {
"object": "users"
}
}
},
{
"name": "users",
"fields": {
"items": {
"collection": "items",
"via": "user"
},
"allofuserprivatedata": {
"collection": "userPrivateDataThings",
"via": "userId"
},
"email": {
"type": "string"
},
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"userProfile": {
"object": "userProfile"
}
}
},
{
"name": "userProfile",
"fields": {
"userid": {
"collection": "users",
"via": "userProfile"
},
"fieldOne": {
"type": "string"
},
"fieldTwo": {
"type": "boolean"
}
}
},
{
"name": "userPrivateDataThings",
"fields": {
"field1": {
"type": "string"
},
"field2": {
"type": "float"
},
"userId": {
"object": "users"
}
}
}
]
当你想要一对多时使用集合。
当你想要 1 对 1 时使用一个对象。
当您使用 deep:true 对用户执行 GET 时,嵌套关系数据将在响应中返回。