Ok so it seems that the include should contain the name of the relation itself (in the json file of "Client" in relations I saw that the has many to insturments relation is called "instrument"), too bad strongloop failed to specify it in their documentation.
eventually this worked :
InstrumentTracking.find({ filter: { where: {userID:$rootScope.currentUser.id}, include:['instrument'] }})
.$promise
.then(function(foundInst) {
var instrument = foundInst[0].instrument;
console.log("foundInst="+JSON.stringify(instrument));
$scope.instrumentTracking = instrument;
}
);
but this didnt work (returned empty instrument array):
Client
.find({ filter: { where: {id: $rootScope.currentUser.id}}})
.$promise
.then(function(foundUsers) {
console.log("foundUsers="+JSON.stringify(foundUsers));
console.log("found == " +JSON.stringify(foundUsers[0]));
console.log(" foundUser.instruments = " + foundUsers[0].instruments.find({}).$promise
.then(function(foundInst) {
console.log("foundInst == " +JSON.stringify(foundInst));
}));
});
For some reason when I try to get the instruments from client model it always returns empty array, even if I use the API Explorer.