title: Connect xampp to MongoDB
body: <p>I have a xampp 1.7.3 instance running and a MongoDB 1.2.4 server on the same machine.</p>
  
  <p>I want to connect them, so I basically have been following <a href="http://www.php.net/manual/en/mongo.manual.php" rel="nofollow noreferrer">this tutorial</a> on php.net, it seems to connect but the cursors are always empty. I don't know what am I missing.</p>
  
  <p>Here is the code I am trying. The cursor->valid always says false. thanks</p>
  
  <pre><code>&lt;?php
  $m = new Mongo(); // connect
  try {
    $m-&gt;connect();
  } catch (MongoConnectionException $ex) {
    echo $ex;
  }
  echo "conecta...";
  $dbs = $m-&gt;listDBs();
  if ($dbs == NULL) {
    echo $m-&gt;lastError();
    return;
  }
  foreach($dbs as $db) {
    echo $db;
  }
  
  $db = $m-&gt;selectDB("CDO");
  echo "elige bd...";
  $col = $db-&gt;selectCollection("rep_consulta");
  echo "elige col...";
  
  $rangeQuery = array('id' =&gt; array( '$gt' =&gt; 100));
  $col-&gt;insert(array('id' =&gt; 456745764, 'nombre' =&gt; 'cosa'));
  $cursor = $col-&gt;find()-&gt;limit(10);
  echo "buscando...";
  var_dump($cursor);
  var_dump($cursor-&gt;valid());
  if ($cursor == NULL) echo 'cursor null';
  while($cursor-&gt;hasNext()) {
      $item = $cursor-&gt;current();
      echo "en while...";
      echo $item["nombre"].'...';
  }
  
  ?&gt;
  </code></pre>
  
  <p>doing this by command line works perfect</p>
  
  <pre><code>use CDO
  db.rep_consulta.find()
  -- lot of data here
  </code></pre>