Skip to content

Limit on number of 'include' statements ? #195

Closed
@danielb93

Description

@danielb93

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.

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