I cannot find out of how to check, if some value are in array property in mongo document. For example, I have some collection users, and such document:
{
'name':'Paul',
'age':43,
'friendsIDs': [ ObjectId('qqq...'), ObjectId('www...'), ObjectId('eee...') ],
}
Now let's suppose that I want to check, is user with ID ObjectId('qqq...') a friend of Paul, or not. This is quite easy to do in almost all programming languages, for example in php it would be something like:
$isFriendOfPaul = in_array( ObjectId('qqq...'), $friendsIds );
But how to query this in mongo? Any ideas?
Actually, it is $in the manual.