I am using loopback to serve the API for my application and I tried to change the GET request for some data.
As of now the query fetches all the results for a particular API:
People.find({
where: {
'town': 'name of a town'
}
}).$promise
// Promise is fulfilled and people returned
.then(function(results) {
$scope.people = results;
})
// Promise is rejected and error catched
.catch(function(err) {
$scope.errors.PeopleFind = JSON.stringify(err.data.error.message ?
err.data.error.message :
err.data.error.errmsg
);
});
I already tried with adding single quotes to the where clause or to do something like .find({ where : { town : 'name of a town' }}
.
No matter where I put the quotes the results are always the whole package. How would I query for just the results that I'm interested in?
Thanks in advance