Load nodes with a fields condition I have node type called online_users.
The node type has a field called field_website_id.
I would like to get the nodes that has a specific field_website_id.

I have try to make the following action but gets an error:

function get_list_of_users($site_id) {
$query = new EntityFieldQuery();
  $entities = $query-&gt;entityCondition('entity_type', 'node')
  -&gt;propertyCondition('type', 'users_online')
  -&gt;propertyCondition('field_website_id', $site_id)
  -&gt;execute();
  if (!empty($entities['node'])) {
    $node = node_load(array_shift(array_keys($entities['node'])));
  }
} 


The error:


  PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column
  'node.field_website_id' in 'where clause': SELECT node.nid AS
  entity_id, node.vid AS revision_id, node.type AS bundle, :entity_type
  AS entity_type FROM {node} node WHERE (node.type =
  :db_condition_placeholder_0) AND (node.field_website_id IS NULL ) ;
  Array ( [:db_condition_placeholder_0] => users_online [:entity_type]
  => node ) in EntityFieldQuery->execute() (line 1140 of /Applications/MAMP/htdocs/Drupal/includes/entity.inc).


What is the right way to do this?
To filter by fields you should use fieldCondition() method instead of propertyCondition()

function get_list_of_users($site_id) { 
  $query = new EntityFieldQuery();
  $entities = $query-&gt;entityCondition('entity_type', 'node') 
    -&gt;propertyCondition('type', 'users_online') 
    -&gt;fieldCondition('field_website_id', $site_id) 
    -&gt;execute(); 
  if (!empty($entities['node'])) {
    $node = node_load(array_shift(array_keys($entities['node'])));
  }
}