title: Query to Collectively Match Intersection of Documents against a Field
body: <p>In MongoDB, how can I return all documents that:</p>
  
  <ol>
  <li>Share a value for a particular field.</li>
  <li>Have a field equal to a value.</li>
  <li>Between all documents that satisfy 1 &amp; 2, they also collectively match all the fields of an inputted array of 1 to n values. I.e., every value must be accounted for.</li>
  </ol>
  
  <p>E.g., given the below collection, I want to match all the documents that:</p>
  
  <ol>
  <li>Have the same <code>channelId</code></li>
  <li><code>dayOfWeek</code> is equal to Monday</li>
  <li><p>Between all documents that satisfy 1 &amp; 2, they should also collectively match product Ids [1, 2]. I.e., if I have a <code>channelId</code> that matches <code>dayOfWeek</code>, it also must have a single document that has <code>productId</code> of 1 and another document with <code>productId</code> of 2.</p>
  
  <pre><code>{
      channelId: "ID-A",
      dayOfWeek: "MONDAY",
      productId: "1"
  }, 
  {
      channelId: "ID-A",
      dayOfWeek: "MONDAY",
      productId: "2"
  },
  {
      channelId: "ID-B",
      dayOfWeek: "MONDAY",
      productId: "1"
  },
  {
      channelId: "ID-B",
      dayOfWeek: "MONDAY",
      productId: "3"
  },
  {
      channelId: "ID-C",
      dayOfWeek: "MONDAY",
      productId: "1"
  },
  {
      channelId: "ID-C",
      dayOfWeek: "TUESDAY",
      productId: "2"
  }
  </code></pre></li>
  </ol>
  
  <p>The desired return in this case would be:</p>
  
  <pre><code>    {
          channelId: "ID-A",
          dayOfWeek: "MONDAY",
          productId: "1"
      }, 
      {
          channelId: "ID-A",
          dayOfWeek: "MONDAY",
          productId: "2"
      }
  </code></pre>
  
  <ul>
  <li>ID-B is removed since it doesn’t have a <code>productId</code> equal to 2. </li>
  <li>ID-C is removed since although both productIds are matched, between the matched items they don’t have a <code>dayOfWeek</code> equal to Monday.</li>
  </ul>