Skip to content

matchesQuery on inner query returns zero objects #1109

@mulp

Description

@mulp

Environment Setup

Parse-server 2.2.0 local installation
MongoDB 3.2.3
iOS SDK 1.12.0

Steps to reproduce

PFQuery *innerQuery = [PFQuery queryWithClassName:@"MonthTranslated"];
[innerQuery whereKey:@"month"  equalTo:currentMonth];

PFQuery *query = [PFQuery queryWithClassName:@"Vegetable"];
query.cachePolicy = kPFCachePolicyCacheElseNetwork;
query.maxCacheAge = kMaxCacheAge;

[query whereKey:@"availableInMonths" matchesQuery:innerQuery];
[query whereKey:@"language" equalTo:language];
[query whereKey:@"active" equalTo:@1];
[query includeKey:@"nutritionalFact"];
query.limit = 20;

[query findObjectsInBackgroundWithBlock:^(NSArray *results, NSError *error) {
        if (!error) {
            // No results
        }
}];

It works correctly on hosted Parse. I have also done the following manual double-checks:

  • Imported the JSON files from Parse (removing the result container from the exported files) into my local mongodb
  • Migrated Parse data to an existing MongoLab instance using the Parse Migration Tool. Afterwards I have exported the MongoLab data and imported into my local Mongo database.
  • Split the above queries running the first one retrieving the MonthsTranslated (it works perfectly) and the second one filtering the result.
  • Tried executing curl request with the same input.

I can confirm this returns more than zero objects. It is currently running on an hosted Parse service. Trying to test on my local installation before to move to a cloud service.

Logs/Trace

  1. Parse server log full response from the iOS request
GET /parse/classes/Vegetable { host: 'localhost:1337',
  'x-parse-client-version': 'i1.12.0',
  accept: '*/*',
  'x-parse-application-id': 'My_App_Key',
  'x-parse-client-key': 'My_Client_Key',
  'x-parse-os-version': '9.2 (15D21)',
  'accept-encoding': 'gzip, deflate',
  'content-type': 'application/json; charset=utf-8',
  'content-length': '190',
  'user-agent': 'AppName/228 CFNetwork/758.2.8 Darwin/15.3.0',
  connection: 'keep-alive',
  'x-parse-app-build-version': '228',
  'x-parse-app-display-version': '2.0.4' } {
  "where": {
    "language": "en",
    "active": 1,
    "availableInMonths": {
      "$inQuery": {
        "where": {
          "month": 3
        },
        "className": "MonthTranslated"
      }
    }
  },
  "include": "nutritionalFact",
  "limit": "2147483647"
}
response: {
  "response": {
    "results": []
  }
}

  1. Curl
**Request**
curl -X GET -H "X-Parse-Application-Id: My_App_ID" -G --data-urlencode  'where={"availableInMonths":{"$inQuery":{"where":{"month":3},"className":"MonthTranslated"}},"language":"en"}' http://localhost:1337/parse/classes/Vegetable

**Response**
GET /parse/classes/Vegetable?where=%7B%22availableInMonths%22%3A%7B%22%24inQuery%22%3A%7B%22where%22%3A%7B%22month%22%3A3%7D%2C%22className%22%3A%22MonthTranslated%22%7D%7D%2C%22language%22%3A%22en%22%7D { host: 'localhost:1337',
  'user-agent': 'curl/7.43.0',
  accept: '*/*',
  'x-parse-application-id': 'My_App_ID' } {}
response: {
  "response": {
    "results": []
  }
}

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