Repository navigation
PFQuery's whereKey:equalTo: function seems not working on Parse Server like before #175
Description
Activity
The solution that I found is to use:
[query whereKey:@"members" containsAllObjectsInArray:@[[PFUser currentUser]]];
Works fine!!The problem is that when it was Parse hosted, it was working well
But it should not. Array of objects can't be equal to object.
See the answer of Héctor Ramos from Parse at this link:
https://parse.com/questions/query-where-the-elements-of-an-array-type-field-are-a-subset-of-a-given-arrayOk, I was wrong, got it. But I can not call it good practice.
I agree with you. An array of objects can't be equal to object.
It would be better with a new function for this case...Hey @leobortolotti , this was reported as a bug as I noticed the same strange behaviour. #74
I worked around this (for now), by storing only the object id's in the array.. You'll have to refactor some of your code, but works just fine with an array of id's.@edvincandon Got it. As I said, I found this solution too:
[query whereKey:@"members" containsAllObjectsInArray:@[[PFUser currentUser]]];
But what you said is a good alternative too!! Thanks!This has been fixed in #284
hey, i have 2.0.8 installed but it seems still not fixed.
this is my query:
[query whereKey:@"bikers" equalTo:[PFUser currentUser]];this is how data stored in db:
"bikers" : [ { "__type" : "Pointer", "className" : "_User", "objectId" : "s6pjE71Hqk" }, { "__type" : "Pointer", "className" : "_User", "objectId" : "27eJDbeT96" } ],but it works with:
[query whereKey:@"bikers" containsAllObjectsInArray:@[[PFUser currentUser]]];did i miss something?
Hi, @drew-gross
Recently, I tried to migrate my app to parse-server and met this issue.
My parse-server version is
2.2.10which this issue should be fixed.I have a class called
Roomwhich has an array fieldmembers.I tried
q.equalTo("members", PFUser.currentUser())returned nothing, but with
q.whereKey("members", containsAllObjectsInArray:[PFUser.currentUser])it worked.
I checked my
_Schemeand it markedroom.membersas an array.Is there any idea why this issue still exist?
I'm seeing the same as @alioguzhan and @kenkuan. Am using a hosted Parse server of version 2.2.19, calling from iOS SDK v.1.14.2 (from cocoapods)
and a query that worked against the original Parse service no longer works.
Key 'userAck' has a value of
[{"__type":"Pointer","className":"UserPublicData","objectId":"hkZD66uTV1"}]and before a query of:
[query whereKey:@"userAck" equalTo:publicUser];
where 'publicUser' is an object of type UserPublicData, worked fine.Now it gets 0 matches and I have to change it to
[query whereKey:@"userAck" containsAllObjectsInArray:@[publicUser]];
to get any results.And while the revised syntax does make more sense it means I've got an unknown about of broken queries throughout my code base, and previously documented behaviour has changed.
The above reported fix #284 does not seem to have worked for several of us.
Has this been resolved? I'm just now running into this issue via JS query.equalTo()
- added a commit that references this issue
on May 6, 2017 - added a commit that references this issue
on May 6, 2017
Hi,
Inside Parse I have a key where I store an array of Pointers. Then I use the PFQuery's function whereKey:equalTo: like this:
[query whereKey:@"members" equalTo:[PFUser currentUser]];The problem is that when it was Parse hosted, it was working well. But now with Parse Server it isn't working. It isn't retrieving the objects from Class that have [PFUser currentUser] inside the key's array.
Is it a bug in Parse Server?