title: Query for records that have a certain elements in an array
body: <p>So I am trying to search for documents that have any of the given tags (i.e. "a", "b", or "c").</p>
  
  <p>The MongoDB query is:</p>
  
  <pre><code>db.my_collection.find({ "tags" : { "$elemMatch" : { "$in" : ["a", "b", "c"] } } })
  </code></pre>
  
  <p>This works just fine (tags is a document field which is an array of tags for the document). Now the problem is when I try to build this query using SpringData Query and Criteria objects.</p>
  
  <pre><code>List&lt;String&gt; tags = Arrays.asList("a", "b", "c");
  Criteria inTags = new Criteria().in(tags);
  Criteria where = Criteria.where("tags").elemMatch(inTags);
  Query query = new Query(where);
  System.out.println(query);
  </code></pre>
  
  <p>The output of this is:</p>
  
  <pre><code>Query: { "tags" : { "$elemMatch" : { }}}, Fields: null, Sort: null
  </code></pre>
  
  <p>Which of course does not end up working for me. Does anyone know how to make this work with SpringData query/criteria. I am not interested in ugly work-arounds or using the MongoDB Java driver directly - I can do that. I want to know if there is any way to do this right with the SpringData classes.</p>