How to use EntityFieldQuery with a simple text field? I have a content type called foo and it has a textfield called field_bar. I have one that has a value set to baz.

I'd like to use the EntityFieldQuery object to find all foos that have field_bar with the baz value.

$nodeQuery = new EntityFieldQuery();
  $nodeQuery-&gt;entityCondition('entity_type', 'node', '=')
    -&gt;entityCondition('bundle', 'foo') 
    -&gt;fieldCondition('field_bar', 'value', '12345', '=');


The problem is that I get no results or error back. If I remove the fieldCondition, I get all foos including the one I am looking for.

As the documentation is vague and only for experts, I googled a lot, but can't find any reason for my query not returning my node.

I also tried with

->fieldCondition('field_bar', 'value', array('12345'), '=');

to see if that matters, but its the same. I dd-ed the $nodeQuery but can't see the executed SQL.

Is there anything special with textfields?
From the canonical reference on EFQs,


  -&gt;fieldCondition($field, $column = NULL, $value = NULL, $operator =
  NULL, $delta_group = NULL, $language_group = NULL)
  
  These conditions are specific to a field implementation.
  
  Looking at the body field in the article node type, a field condition
  would look like this:
  ->fieldCondition('body', 'value', 'A', 'STARTS_WITH')
  
  
  field name. Though the field table in the database is named 'field_data_body', the actual field name is 'body'. This is in the
  field_config_instance table.
  column. This is the column in the database that should be matched, with field name prefix removed. For body field, the database columns
  are: body_value, body_summary, body_format, and language. 'value',
  'summary', 'format', and 'language' are the actual arguments you would
  use. Likewise an image field would use 'fid', 'alt', and 'title' as
  column names; an entity reference field would use 'target_id' and
  'target_type' as column names.
  


So, your syntax is correct, assuming your field name is correct (you want the machiine name), and your column is correct.  Text and Longtext fields both use "value".  You can verify this by looking at the database itself.

If your field name is field_bar, there will be a table called field_data_field_foo.  Look at the columns.  You should see one called field_bar_value.