Skip to content

Query on Pointer Array Issue #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
edvincandon opened this issue Jan 30, 2016 · 2 comments
Closed

Query on Pointer Array Issue #74

edvincandon opened this issue Jan 30, 2016 · 2 comments
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@edvincandon
Copy link

I keep track of certain users by adding them to an array of pointers in the database.
My app is a turn-based game (3 turns exactly, that's why I opted for an array of user pointers as it wouldn't create very long arrays).. Each game keeps track of users playing by adding User Pointers to userHistory. It looks like this:

"userHistory": [
{
"__type": "Pointer",
"className": "_User",
"objectId": "pv54RnXqqj"
},
{
"__type": "Pointer",
"className": "_User",
"objectId": "Xqqpv33Rnj"
} ],`

That part still works fine since the migration.

Problem is when I query on userHistory. For instance, I want to retrieve all games where a certain user has participated. When previously using Parse, I would simply:

gameQuery.equalTo("userHistory", object); // where object is a pointer to a specific user

And that would work.

Querying for a specific pointer on an array of pointers doesn't seem to work with equalTo() as it used to.
It's giving me 0 results.

What am I missing?

EDIT
I worked around this for now by storing object ID's and not pointers. No problem with query.equalTo() on array of ids.

@edvincandon
Copy link
Author

Weird, it seems to work when my array userHistory of user pointers only has 1 entry.
It seems the equalTo behaviour isn't iterating through the array?

@gfosco
Copy link
Contributor

gfosco commented Jan 30, 2016

Looks like we specifically tested the 1 entry scenario: https://github.com/ParsePlatform/parse-server/blob/master/spec/ParseQuery.spec.js#L2059

But we'll have to add a test for multiple and then fix it.

@gfosco gfosco added the type:bug Impaired feature or lacking behavior that is likely assumed label Jan 30, 2016
bernhardharrer pushed a commit to bernhardharrer/parse-server that referenced this issue Feb 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

No branches or pull requests

3 participants