Skip to content

Query applies default Limit to 100 #58

@tuhin-sheikh-cmc

Description

I was using Query to get content from contentful. Documentation says setLimit can be set between 1 and 1000, and to set null to reset it (which I believe makes it not to limit, or limit it to maximum which is 1000). however, in our case, when we didn't use setLimit on the query, it was always returning 100 results. When added ->setLimit() or ->setLimit(null), hoping it would not set any limit or return the maximum limit, it didn't work either.

If you have default limit set to 100, please update it in the docs. Also looks like resetting it with null is not working as well, unless I'm doing it wrong (then please let me know how to remove limit from the query). Thanks.

code snippet below (I am using client with preview):

use Contentful\Delivery\Client;
use Contentful\Delivery\Query;
...
$query = new Query();
$query->setContentType(self::CONTENTFUL_TYPE_TRANSLATION)
        ->orderBy('-sys.createdAt')
        ->setLimit(1000)//by default query pulling 100 entries
        ->setInclude(1);
try {
        $entries = $this->client->getEntries($query);
} catch (...

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