title: How to search firstname and lastname in mongodb
body: <p>I read this article and saw how to search for the firstname of a record in mongodb:</p>
  
  <p><a href="http://docs.mongodb.org/manual/reference/sql-comparison/" rel="nofollow">http://docs.mongodb.org/manual/reference/sql-comparison/</a></p>
  
  <pre><code>db.users.find({ firstname: /^bc/ });
  </code></pre>
  
  <p>but how do I search for the firstname and lastname given that my string has two words (which is the firstname and lastname).</p>
  
  <p>In MySQL, I am using:</p>
  
  <pre><code>SELECT * FROM profiles WHERE match(firstname, lastname) AGAINST ('".$data."');
  </code></pre>
  
  <p>Where data contains "mike thompson".</p>