Skip to content

Support deeply nested pointers in 'containedIn' queries #7414

Open
@oallouch

Description

@oallouch

New Issue Checklist

Issue Description

Querying using "containedIn" in deep nested objects using pointers doesn't seems to work.

Steps to reproduce

See example below.

Actual Outcome

The queries return empty arrays.

Expected Outcome

We expected an array of Parse.Object .

Failing Test Case / Pull Request

  • 🤩 I submitted a PR with a fix and a test case.
  • 🧐 I submitted a PR with a failing test case.

To reproduce the issue, I added this at the end of ParseQuery.spec.js

  it('deeply nested Pointers (issue #7413)', async function (done) {
    const parent = new Parse.Object('Parent');
    const child1 = new Parse.Object('Child');
    const child2 = new Parse.Object('Child');

    parent.set('children', [
      { child: child1, count: 2 },
      { child: child2, count: 3 },
    ]);
    await parent.save();

    const results = await new Parse.Query('Parent')
      .containedIn('children.child', [child1])
      .find();
    expect(results.length).toBe(1);
    done();
  });

This test passes if I replace the line :
.containedIn('children.child', [child1])
by
.containedIn('children.child.objectId', [child1.id])

Environment

parse-server 4.5.0

Server

  • Parse Server version: 4.5.0
  • Operating system: Windows and debian
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): local Windows and Google App Engine

Database

  • System (MongoDB or Postgres): MongoDB
  • Database version: 4.4.6
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): local and MongoDB Atlas

Client

  • SDK (iOS, Android, JavaScript, PHP, Unity, etc): Javascript
  • SDK version: 3.2

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions