回环引用很多嵌套的外键

我想引用一个不同的模型(这里描述: https ://loopback.io/doc/en/lb2/Embedded-models-and-relations.html),但是通过一个嵌套的 id:

{ "name" : "person", ... "relations": { "cars": { "type": "referencesMany", "model": "car", "foreignKey": "cars.id" } } 

json的人实际上会是这样的:

 { ... cars: [{"id": 1, "name": "car1"}, ...] } 

而汽车模型将成为全车细节

我必须写我自己的远程方法来做到这一点?

Interesting Posts