Loopback issues when adding relations Loopback issues when adding relations json json

Loopback issues when adding relations


Your foreign key is not correct, as per the documentation it should be,

Relation name: Camel case of the model name, for example, for the "supplier" model the relation is "supplier".

Foreign key: The relation name appended with ‘Id’, for example, for relation name "supplier" the default foreign key is "supplierId".

So in your case it should be

"foreignKey": "userId"

https://docs.strongloop.com/display/public/LB/HasOne+relations

And you should use the slc relations instead of editing the json files.


I believe Container should inherit Model, not PersistedModel. By default, a Container is a folder inside a filesystem, so there is no choice of persisting it or not.

 {    "name": "Container",    "base": "Model",