title: Using Regex in mongodb
body: <p>I'm trying to use regular expressions in my mongodb queries. 
  According the documentation I can run a regular expression in my query like this :</p>
  
  <pre><code>db.customers.find( { name : /^foo.bar/ } );
  </code></pre>
  
  <p>But <strong>is there a way to store a regex in the document and retreive the documents where the regex  matches a supplied string ?</strong></p>
  
  <p>Example document :</p>
  
  <pre><code>{ _id : SomeID , matcher : "/^foo.bar/" }
  </code></pre>
  
  <p>Query (in my dreams).</p>
  
  <pre><code>db.customers.find( { matcher : { $matches : "foozbar" } );
  </code></pre>