Trouble understanding eager loading I've tried to apply eager loading per Craft's docs, but it doesn't seem to work. When I do this, will I have access to all the entry fields? If not, do I have to include all the fields I want in the with attribute?

{% for entry in craft.entries.section('news').with['image'] %}
  {% set image = entry.image[0] ?? null %}
  {% if image %}
    &lt;img src="{{ image.url }}"&gt;
  {% endif %}
  {{ entry.title }}
{% endfor %}


When I tried it, the code barfed when trying to output {{ entry.title }}.
The original answer is good, but as noted, somewhat incorrect, at least concerning a chainable .with() method.

Here's my attempt to explain things: Speed up your Craft CMS Templates with Eager Loading