title: Find document with URI pattern match
body: <p>My collection consists of API URI endpoint info.  I want to be able to pass a URI as a search string into MongoDB, and find the document that matches the URI pattern.   </p>
  
  <p>For example</p>
  
  <p>If I pass "/api/name/jason/profile"</p>
  
  <p>I want to search all the documents in my collection for the doc that contains...</p>
  
  <p>URI:"/api/name/(:*)/profile"</p>
  
  <p>(:*) being a wildcard.</p>
  
  <p>Any suggestions on how I should go about doing this?</p>
  
  <p>UPDATE:::
  To clarify...</p>
  
  <p>That would work if I had a simple pattern that didn't really change. But the problem is that I might not know which part of the URI is dynamic .. So what I really need to do is compare my URI with a collection of documents that all contain different URI patterns so my documents might have patterns like so... </p>
  
  <pre><code>/api/name/{id}/ 
  /api2/event/{id} 
  /api/events/{from_date}/{to_date}
  </code></pre>
  
  <p>What I want to do is find a document that best matches a URI pattern that I pass.</p>
  
  <p>So if I pass "/api/events/20170102/20170330" then Mongo will return the document that has a "uri":"/api/events/{from_date}/{to_date}" pattern.</p>