parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

Limit on number of 'include' statements ?

Open danielb93 opened this issue 10 years ago • 2 comments

I've began the tedious process of migrating over to a self-hosted Parse 'stack' and have ran into an issue where 'include' statements are ignored if more than 10 are included.

I'm using a locally hosted MongoDB and a local v2.0.5 instance of 'parse-server' and interacting with it via the v1.1.10 PHP SDK. Example code below:

public function allTheIncludes() {

        $query = new ParseQuery('GameScore');
        $query->includeKey('field1');
        $query->includeKey('field2');
        $query->includeKey('field3');
        $query->includeKey('field4');
        $query->includeKey('field5');
        $query->includeKey('field6');
        $query->includeKey('field7');
        $query->includeKey('field8');
        $query->includeKey('field9');
        $query->includeKey('field10');

        try {

            $result = $query->first();
        } catch(ParseException $e) {

            die("{$e->getMessage()} \n\n" . $e->getTraceAsString());
        }

        //Assign pointer to variable
        $pointer    = $result->get('field6');

        // Ensure pointer value is set and grab name
        if(!empty($pointer)) {

            $name = $pointer->get('name');
            die("Name from pointer is: {$name}");
        }

        die("Pointer value is empty :(");
    }

The above works fine, outputting Name from pointer is: Jeff

However adding an additional include causes the above code to throw an exception:

ParseObject has no data for this key. Call fetch() to get the data.

Is there a hard limit imposed for the number of includes allowed or is this unintentional (this code executes successfully on a Parse hosted instance)?

EDIT: It also seems that if you try to include a field that has already been included that points to the same record it causes that record to not be included at all.

Example:

If field1 and field7 point to a record in the _User class with an objectId of fuvNKdxHKo and you include both fields, that object will not be included. Accessing a field within that pointer will throw an exception.

danielb93 avatar Feb 03 '16 05:02 danielb93

I don't see any limits being imposed on this, in RestQuery.js... Try creating a failing test in ParseQuery.spec.js

gfosco avatar Feb 03 '16 08:02 gfosco

#426 see if this is your case.

mchun avatar Feb 16 '16 13:02 mchun