Using EntityFieldQuery it is pretty easy to query for entities with a given value for a specific field. But I fail to find a way to query for entities without a value for a given field. Let's say I have an optional Taxonomy Reference field on all my content type. I can query the nodes associated with a given taxonomy term using:
$query = new EntityFieldQuery(); $query->entityCondition('entity_type', 'file') ->fieldCondition('field_tags', 'tid', $tid) ->pager($limit); $results = $query->execute();
But how would I query for all nodes not associated with any terms (ie. which have no value for the
field_tags field). I tried setting
$query->fieldCondition('field_tags', 'tid', $all_tids, 'NOT IN') without success.