I have an entity with a user entityReference field, which may contain multiple values. I wish to select using EntityQuery the nodes that do NOT contain the uid in the query.
$query ->condition('field_shared_with_user.target_id', $uid, '<>');
This only works to exclude $uid if there is only ONE value in the field. If $uid is present but some other uid is also present, it incorrectly includes this node in the result.
What is the correct syntax for writing a condition for a multiple value field?
The most I can find about writing these queries is here: