title: Tag autocomplete in MongoDB
body: <p>I have a collection of documents with <code>tags</code> arrays, containing 0+ strings.</p>
  
  <p>I want to offer a search by tag UI field that autocompletes valid tags. This would be done by having a collection of all those tags, which is essentially an index of the tags field, and doing, i.e., <code>{tags:{$regex:/^ro/}}</code> as each character is typed in the field. As they type, valid tags such as "rome", "role", etc appear.</p>
  
  <p>Once some tags are specified in the UI, the user performs an actual search that includes the tags among other things, doing a regular <code>find</code> expression. <strong>I do not want text search for the tags field, so please don't suggest that.</strong></p>
  
  <p>In other words, for the tag autocomplete, I <em>don't need</em> the references to the documents tagged, I only need a list of the tags that match the regex.</p>
  
  <p>Do I need to maintain my own collection of tags, or can I somehow use a <code>tags</code> index for this?</p>