Skip to content

Query on Pointer Array Issue #74

Description

@edvincandon

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.

Activity

  1. edvincandon commented on Jan 30, 2016

    @edvincandon
    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?

  2. gfosco commented on Jan 30, 2016

    @gfosco
    Contributor

    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.

  3. added
    type:bugImpaired feature or lacking behavior that is likely assumed
    on Jan 30, 2016
  4. added a commit that references this issue on Feb 22, 2017
    c86fab4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions