What query selector can find any array item matching any item from another array?
<p>Is there a mongo query selector allowing me to retrieve every document where, in an array field, at least one item match at least one item from another array?</p>

<p>Let's say I have a mongo document with an array of string in the <code>reference</code> field</p>

<pre><code>reference: [
    "foo",
    "bar",
    "or",
    "not"
]
</code></pre>

<p>and I want to select all the documents where I can find an item in the reference array field matching any of the item I have in another array in a javascript variable (let's call it <code>target</code>)</p>

<pre><code>  var  target= [
        "yes",
        "but",
        "not ",
        "yet"
    ];
</code></pre>

<p>In this example it would match because <code>not</code> is in both arrays.</p>

<p>I know I can do it using <code>$in</code> if I look for only one element in a mongo array. However, I would prefer to avoid iterating on my <code>target</code> array to look for each item it contains in the <code>reference</code> array.</p>