title: How to check if an array field is a part of another array in MongoDB?
body: <p>In this <a href="https://stackoverflow.com/questions/5366687/how-to-check-if-an-array-field-contains-a-unique-value-or-another-array-in-mongo">question</a>, Jeff the Bear explained how to search documents with an array</p>
  
  <pre><code>contains 'tag1'
  contains ['tag1','tag2'],
  contains any of ['tag3', 'tag4']
  </code></pre>
  
  <p>But how should I do if I want to search documents with an array which is part of another array? </p>
  
  <pre><code>post1.tags = ['tag1']
  post2.tags = ['tag1','tag3']
  post3.tags = ['tag2','tag4']
  post4.tags = ['tag1','tag2','tag3','tag4']
  </code></pre>
  
  <p>I want to get post1 and post3 because they have tags </p>
  
  <pre><code>contained in ['tag1', 'tag2', 'tag4']
  </code></pre>
  
  <p>I don't want to get post2 and post4, because tag3 doesn't exist in <code>['tag1', 'tag2', 'tag4']</code></p>
  
  <p>In other words, select posts that all elements in its tags array can be found in another conditional array</p>