parse-server: Relational query returns 0 object on iOS SDK
Make sure these boxes are checked before submitting your issue – thanks for reporting issues back to Parse Server!
- You’ve met the prerequisites.
- You’re running the latest version of Parse Server.
- You’ve searched through existing issues. Chances are that your issue has been reported or resolved before.
Environment Setup
Ubuntu 14.04 64 bit Parse-Server 2.1.6
Steps to reproduce
I’m doing relational query to get opening hours of a restaurant where restaurant name matches certain keywords. When I’m querying it on my iOS app, it returns 0 object.
PFQuery *restaurantQuery = [PFQuery queryWithClassName:@"Restaurant"];
[restaurantQuery whereKey:@"name" equalTo:self.selectedRestaurantName];
PFQuery *hoursQuery = [PFQuery queryWithClassName:@"Hour"];
[hoursQuery whereKey:@"restaurant" matchesKey:@"objectId" inQuery:restaurantQuery];
[hoursQuery whereKey:@"days" equalTo:[NSString stringWithFormat:@"%ld", (long)[Utility getWeekday]]];
[hoursQuery findObjectsInBackgroundWithBlock:^(NSArray * _Nullable objects, NSError * _Nullable error) {
if (!error) {
self.restaurantHours = [[NSArray alloc] initWithArray:objects];
} else {
NSLog(@"%@", error);
self.restaurantHours = [[NSArray alloc] init];
}
[self.tableView reloadData];
}];
But when I tried to query it using cURL, it returns the result that I needed.
curl -X GET -H "X-Parse-Application-Id: myAppID" -H "X-Parse-REST-API-Key: myRESTKey" -G --data-urlencode 'where={"restaurant":{"$inQuery":{"where":{"name":"selectedRestaurantName"},"className":"Restaurant"}},"days":"3"}' https://my_url.com:1337/parse/classes/myClass
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 17 (6 by maintainers)
if that’s like that then :