I've currently built an API using Loopback
based on an existing DB and schema from an older API. Everything works very well with the exception of 'populate' or related models
.
I would like to be able to query related models in the loopback way, like so
User.find({include: 'test'}, function() { /* ... */ });
i've added the relations in the JSON files
"relations": {
"test": {
"type": "hasOne",
"model": "Address",
"foreignKey": "addressId"
}
}
however I can't seem to get anything to be returned - although I can see the additional properties in the explorer.
So, my question is, can related models be set-up over existing data or does it have to be populated as the data is created?
EDIT: my connector is mongo