title: MongoDB::Cursor object returning repeated records in perl
body: <pre><code>use MongoDB;
  my $dbClient = MongoDB::MongoClient-&gt;new();
  my $db = $dbClient-&gt;get_database( 'exp_new' );
  my $rsvnCollection = $db-&gt;get_collection( 'reservations' );
  my $rsvnDB = $rsvnCollection-&gt;find({parent_id =&gt; {'$exists' =&gt; 1}});
  my $explanation = $rsvnDB-&gt;explain;
  my $num = $rsvnDB-&gt;count;
  </code></pre>
  
  <p>The explanation is giving me </p>
  
  <pre><code>$VAR1 = {
            'nscannedObjectsAllPlans' =&gt; 45824,
            'n' =&gt; 33459,
  </code></pre>
  
  <p>and $num returns the same.</p>
  
  <p>And I am trying to access the records like this </p>
  
  <pre><code>while (my $record = $rsvnDB-&gt;next) {
  </code></pre>
  
  <p>It is giving me duplicate records and while loop runs for more than number of records than returned in explanation.</p>
  
  <p>Is there anything wrong in the way I am doing? Any idea why it is giving duplicate records?</p>
  
  <p>Thanks
  Raj</p>
  
  <p>Sample Record:</p>
  
  <pre><code>&gt; db.reservations.findOne({parent_id: {$exists : 1}})
  {
      "_id" : 428,
      "created_user" : "george",
      "status" : NumberLong(2),
      "topologies" : [ ],
      "parent_id" : 428,
      "end_time" : ISODate("2012-08-25T01:45:00Z"),
      "reserved_ports" : {
          "bangalore" : [
              "eth 12/1",
              "eth 12/10",
          ]
      },
      "repeatInfo" : {
          "recurrEndType" : "Occurrences",
          "recurrType" : "Daily",
          "recurrValue" : NumberLong(9)
      },
      "created_time" : ISODate("2012-08-24T00:16:34Z"),
      "name" : "George",
      "start_time" : ISODate("2012-08-24T16:20:01Z"),
      "deleted" : "0",
      "task" : "ACTIVATION",
      "modified" : "0",
      "devices" : [
          "bangalore"
      ],
      "updated_time" : ISODate("2012-08-30T01:44:55Z"),
      "ports" : [ ],
      "updated_user" : "George",
      "reserved_devices" : [
          "bangalore"
      ],
      "topology_details" : [ ]
  }
  &gt; 
  </code></pre>