Impossible to invoke a method ("limit") on an array I recently upgraded a site from Craft 2 to Craft 3, so I'm trying to figure out what was deprecated and caused this error. 

At the top of the page I have this

{% set solutions = craft.entries.section('solutions').level(1).all() %}


And I'm trying to invoke a dropdown menu like so 

&lt;li class="nav-item {% if craft.request.segment(1) == 'solutions' %}active{% endif %}"&gt;
    {% nav solution in solutions.limit(1) %}
        &lt;a class="nav-link" href="{{ solution.url }}"&gt;solutions&lt;span class="sr-only"&gt;(current)&lt;/span&gt; &lt;i class="icon-downarrow"&gt;&lt;/i&gt; &lt;/a&gt;
    {% endnav %}
    &lt;ul class="submenu"&gt;
        {% nav solution in solutions %}
            &lt;li&gt;
                &lt;a href="{{ solution.url }}"&gt;{{ solution.title }}&lt;/a&gt;
            &lt;/li&gt;
        {% endnav %}
    &lt;/ul&gt;
&lt;/li&gt;


Before I didn't have .all() at the end, but only the first menuitem was showing up.
When I added .all() in, I get the error "Impossible to invoke a method ("limit") on an array."
craft.entries now returns an ElementQuery. When you add the .all() you're telling Craft to execute the query, which returns an array of Elements.

That means that solutions is now a simple array, and won't have methods like .limit(1) that can be executed on it. It looks like you just want to use the first item in the solutions array, so try changing this:

      {% nav solution in solutions.limit(1) %}
           &lt;a class="nav-link" href="{{ solution.url }}"&gt;solutions&lt;span class="sr-only"&gt;(current)&lt;/span&gt; &lt;i class="icon-downarrow"&gt;&lt;/i&gt; &lt;/a&gt;
      {% endnav %}


To this:

       &lt;a class="nav-link" href="{{ solutions[0].url }}"&gt;solutions&lt;span class="sr-only"&gt;(current)&lt;/span&gt; &lt;i class="icon-downarrow"&gt;&lt;/i&gt; &lt;/a&gt;


More here: {% nav %} Tags