title: How to query mongo in php?
body: <p>So I've got this simple login function that is trying to match email address with a password in the database and compare it with the user entered data via form. </p>
  
  <pre><code>function login($email, $password){
      $m = new Mongo("localhost"); 
      $m-&gt;connect();
      $db = $m-&gt;users;
      $collection = $db-&gt;test_collection;
  
      echo "&lt;pre&gt;";
      var_dump($collection-&gt;findOne(array('name' =&gt; 'john'))); //returns correctly
      var_dump($collection-&gt;find(array('name' =&gt; 'john'))); //returns mongo cursor object
      echo "&lt;/pre&gt;";
  }
  </code></pre>
  
  <p>I don't understand why the find() only returns a cursor object. Answers?</p>
  
  <p>This is the mongo document</p>
  
  <pre><code>array(5) {
    ["_id"]=&gt;
    object(MongoId)#22 (1) {
      ["$id"]=&gt;"4d7eaa848baf84d32b000000"
    }
    ["activated"]=&gt; (true)
    ["email"]=&gt; "john@smith.com"
    ["name"]=&gt; "john"
    ["password"]=&gt; "334c4a4c42fdb79d7ebc3e73b517e6f8"
  }
  </code></pre>
  
  <p>How would I do a "WHERE" query that would find both email and password in the same document? I'm obviously not getting the paramaters correct for the find() and findOne() queries. What is the correct syntax in PHP?</p>