How do I query for content that has not been updated (no revisions)? I am creating an API endpoint that serves as a content Feed that pulls in content according to some rules.

One group of content that I want to pull is articles that have been updated and that have been approved to be included in the feed. My approach for this was to include a boolean field for including it in the feed, and query for the number of revisions.

$firstGroup = $query-&gt;andConditionGroup()
    -&gt;condition('type', ['article', 'video_game'], 'IN')
    -&gt;condition('status', NodeInterface::PUBLISHED)
    -&gt;condition('field_include_in_feed', 1)
    -&gt;condition('revision_uid', '1', '&gt;=');

$nids = $query-&gt;condition($firstGroup)-&gt;condition($secondGroup)-&gt;execute();


Based on this page from the documentation, I thought revision_uid would be a valid field, but I get an error that it is not. Likewise I get an error, if I use revision as well. 

The error is a Drupal QueryException with the message 'revision_uid' not found.

What is the best way to query for content (with entityQuery) that has been updated if I can't use the revision fields?
Content that has not been updated would only have one revision, so you could count the number of revisions and use a having condition.

First you'll have to join the node_revision table to the node table

$query-&gt;leftJoin('node_revision', 'r', 'n.nid = r.nid');


Count the number of revisions

$query-&gt;addExpression('COUNT(n.nid)', 'revision_count');


Filter rows with a revision_count higher than 1

$query-&gt;havingCondition('revision_count', 1, '&lt;=');