Reputation: 20726
is it possible to find all records in an collection where the MongoID is not in an provided array?
Something like this (?):
$search = array(
'_id' => array('$ne' => $ids)
'readby' => array('$ne' => $userId) // works
);
Iam using PHP with the Mongo Extension.
Upvotes: 1
Views: 4364
Reputation: 26258
Use $nin
instead of $ne
with arrays. Something like:
$search = array(
'_id' => array('$nin' => $ids),
'readby' => array('$ne' => $userId)
);
should do what you want.
Upvotes: 5