<p>The reason this happens is Craft has a default limit of 100 for all ElementCriteriaModel objects (this includes assets, categories, entries, tags, and users, <a href="https://craftcms.com/docs/templating/elementcriteriamodel#creating-an-elementCriteriaModel" rel="nofollow noreferrer">also relations</a> as you encountered). </p>

<p>This isn't made terribly clear in the documentation, but you can see it under <a href="https://craftcms.com/classreference/models/ElementCriteriaModel#defineAttributes-detail" rel="nofollow noreferrer">the defineAttributes() method on the ElementCriteriaModel class reference page</a>.</p>

<p>As you discovered, adding a <code>.limit(null)</code> parameter overrides that limit.</p>

CC BY-SA 3.0
2018-02-25T18:21:43.487Z
2018-02-25T18:39:46.803Z
2018-02-25T18:39:46.803Z
Sapphireblue
<p>Despite using null and paginate false i can still only return 100 queries with this:</p>

<pre><code>{% set results = craft.entries({
    limit: null,
    paginate: false,
    section: 'directory',
    relatedTo: relationParam
}) %}
</code></pre>

<p>How do I get all of them?</p>

<p><strong>* UPDATE *</strong></p>

<p>Well I found the problem and solution which is a bit strange - makes no sense to me.
I am passing relatedTo a merged string 'relationParam' which has the mulitpple categories I want to search for. Once I set the limits on the categories that are related to the entries -see below - it all works.</p>

<pre><code>{% set c = craft.categories.group('locations').slug(countrySlug).limit(null) %}
{% set p = craft.categories.group('locations').slug(portSlug).limit(null) %}
</code></pre>

<p>So what doesn't make sense to me is that I am having to set the limit outside of the main entries query. I would have thought the entry limit specification would do this  not on the categories related.</p>

CC BY-SA 3.0
2016-11-11T18:32:12.127Z
There isn't a `paginate` parameter, so you can safely remove that. Maybe you just happen to have exactly 100 related entries?
Brad Bell
CC BY-SA 3.0
2016-11-12T08:28:13.110Z
Nah I am expecting 410. I am outputting a count on screen of the results array and its always 100
joomkit
CC BY-SA 3.0
2016-11-13T11:04:53.033Z
What happens if you set the limit parameter to 410? How do you know that there should be 410 entries?
Mats Mikkel Rummelhoff
CC BY-SA 3.0
2016-11-14T10:07:21.580Z
If I set the limit to 500 I still get just a 100 records returned. If I take out the 'relatedTo' params ( my search query) then I get my 410 records.
It seems that relatedTo params is enforcing a limit
joomkit
<limit><query>
Only allowed 100 queries with relatedto?
# Only allowed 100 queries with relatedto?

(Asked by: username_0 on 2016-11-11)

Despite using null and paginate false i can still only return 100 queries with this:
{% set results = craft.entries({
    limit: null,
    paginate: false,
    section: 'directory',
    relatedTo: relationParam
}) %}

How do I get all of them?
* UPDATE *
Well I found the problem and solution which is a bit strange - makes no sense to me.
I am passing relatedTo a merged string 'relationParam' which has the mulitpple categories I want to search for. Once I set the limits on the categories that are related to the entries -see below - it all works.
{% set c = craft.categories.group('locations').slug(countrySlug).limit(null) %}
{% set p = craft.categories.group('locations').slug(portSlug).limit(null) %}

So what doesn't make sense to me is that I am having to set the limit outside of the main entries query. I would have thought the entry limit specification would do this  not on the categories related.

**Tags:** limit, query
> **Comments:**
> **username_1**: There isn't a `paginate` parameter, so you can safely remove that. Maybe you just happen to have exactly 100 related entries?  
> **username_0**: Nah I am expecting 410. I am outputting a count on screen of the results array and its always 100  
> **username_2**: What happens if you set the limit parameter to 410? How do you know that there should be 410 entries?  
> **username_0**: If I set the limit to 500 I still get just a 100 records returned. If I take out the 'relatedTo' params ( my search query) then I get my 410 records. It seems that relatedTo params is enforcing a limit  

---

## 1 answers

### Answer by username_3 on 2018-02-25. Score: 1 | Accepted answer

The reason this happens is Craft has a default limit of 100 for all ElementCriteriaModel objects (this includes assets, categories, entries, tags, and users, [also relations](https://craftcms.com/docs/templating/elementcriteriamodel#creating-an-elementCriteriaModel) as you encountered).

This isn't made terribly clear in the documentation, but you can see it under [the defineAttributes() method on the ElementCriteriaModel class reference page](https://craftcms.com/classreference/models/ElementCriteriaModel#defineAttributes-detail).

As you discovered, adding a `.limit(null)` parameter overrides that limit.


---

