Does anyone has any idea how to create a EntityFieldQuery on nodes without a specific field?

For example: 10 nodes of different content-types, 3 of them with a field called "field_counter", 7 without this field ...

How do I get the 7 nodes without (!) the field "field_counter"?

$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node')
      ->fieldCondition('field_counter', ...);

Comments

skipyT’s picture

This should return the expected results:

$field_info = field_info_field( 'field_counter');

$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node')
      ->entityCondition('bundle', $field_info['bundles']['node'], 'IN');