In a mongo database with an array field titled interests, when i need to look for people interested in either judo OR mma, i write the query like this:
{interests : {$regex: "judo|mma", $options: 'i'}}
How do i find people interested in judo AND mma?
Note: I've tried the following and various variations of these but none seem to work :
{interests : {$regex: "(?=judo)(?=mma)", $options: 'i'}},
{interests : {$regex: "(?=.*judo)(?=.*mma)", $options: 'i'}}
Thanks.
something like this should work :
{interests: {$all: [/^judo$/i, /^mma$/i]}