title: $regex to find a document in mongodb that contains a string
body: <p>I am working on a db query in <code>mongo</code> where i need to query the document by regular expressing the <code>string</code> field(<strong>fieldToQuery</strong>).</p>
  
  <p>the <strong>datastructure</strong> is like</p>
  
  <pre><code>{
       fieldToQuery : "4052577300",
       someOtherField : "some value",
       ...
       ...
  }
  </code></pre>
  
  <p>I have the value like <code>"804052577300"</code>, using which i have to query the above document.</p>
  
  <p>How to achieve the same using <strong>$regex</strong> operator?</p>
  
  <p>Update:</p>
  
  <p>I need to do like ends with <code>regex in mongo</code>.</p>