title: How to select subdocuments with MongoDB
body: <p>I have a collection with a subdocument <em>tags</em> like :</p>
  
  <pre><code>Collection News :
     title (string)
     tags: [tag1, tag2...]
  </code></pre>
  
  <p>I want to select all the tags who start with a pattern, but returning only the matching tags.</p>
  
  <p>I already use a regex but it returns all the news containing the matching tag, here is the query :</p>
  
  <pre><code>db.news.find( {"tags":/^proga/i}, ["tags"] ).sort( {"tags":1} ).
      limit( 0 ).skip( 0 )
  </code></pre>
  
  <p>My question is : How can I retrieve all the tags (only) who match the pattern ? 
  (The final goal is to make an autocomplete field)</p>
  
  <p>I also tried using distinct, but I didn't find a way to make a distinct with a find, it always returning me all the tags :(</p>
  
  <p>Thanks for your time</p>