title: Parse.com greater than returning duplicates
body: <p>I'm using this <a href="https://github.com/apotropaic/parse.com-php-library" rel="nofollow noreferrer">PHP parse.com API library</a> to retrieve rows from a table from <em>Parse</em>.</p>
  <p>Due to the limit of maximum 1000 rows per request, I'm retrieving them in a <em>for</em> loop like this:</p>
  <pre><code>$lastUpdated = null;
  
  $parse = new parseQuery($tableName);
  
  $parseAllResults = array();
  $skip = 0;
  
  do {
      $index = count($parseAllResults) - 1;
  
      if($skip === 10000) {
          $lastUpdated = $parseAllResults[$index]['updatedAt'];
  
          $skip = 0;
      }
  
      $parseResults = queryParseCrawlObjects($lastUpdated, $skip);
  
      if (!empty($parseResults)) {
          $skip += 1000;
      } else {
          $skip = 0;
      }
  
      $parseAllResults = array_merge($parseAllResults, $parseResults);
  } while ($skip &gt; 0);
  
  function queryParseCrawlObjects($parse, $lastUpdated, $skip) {
      global $parse;
  
      date_default_timezone_set('UTC');
  
      $parse-&gt;orderBy('updatedAt');
  
      if ($lastUpdated != null) {
          $parse-&gt;whereGreaterThan('updatedAt', $parse-&gt;dataType('date', $lastUpdated));
      } else {
          $parse-&gt;whereNotEqualTo('objectId', '');
      }
  
      $parse-&gt;setLimit(1000);
      $parse-&gt;setSkip($skip);
  
      $results = $parse-&gt;find();
  
      return $results['results'];
  }
  </code></pre>
  <p>I'm using the <code>whereNotEqualTo('objectId', '');</code> restriction as a workaround for a bug in the library, that practically retrieves all the rows, and the <code>skip</code> parameter ro retrieve them in a batch of 1000 rows.</p>
  <p>Another limitation of <em>Parse</em> is that it doesn't allow a <code>skip</code> greater than 10.000. So I use the <code>updatedAt</code> field of the last row in the first 10.000 batch, as a restriction for the next rows.</p>
  <p>And after the first 10.000 rows, it calls the <code>whereGreaterThan</code> method, that internally adds the <code>gt</code> <em>(greater than)</em> <em>Parse</em> parameter to the <em>curl</em> request.</p>
  <p>The problem is that in the second loop step, it returns the same row as the last one from the previous step, and I get an error for duplicate <code>objectId</code> when I try to insert them into a database.</p>
  <p>So the array looks something like this:</p>
  <pre><code>// first step
  $parseAllResults[0] = array('objectId' =&gt; 'ihJikHNkjH', ...);
  $parseAllResults[1] = array('objectId' =&gt; 'sHJKHfddkO', ...);
  ...
  $parseAllResults[9999] = array('objectId' =&gt; 'rukBfcaDFR', ...);
  
  // second step
  $parseAllResults[10000] = array('objectId' =&gt; 'rukBfcaDFR', ...);
  $parseAllResults[10001] = array('objectId' =&gt; 'gusFGvQWVs', ...);
  ...
  $parseAllResults[19999] = array('objectId' =&gt; 'asHppNVAaD', ...);
  </code></pre>
  <p>with the 9999th and 10000th having the rest of the properties equal, so I'm sure it's the same row from <em>Parse</em> retrieved twice.</p>
  <p>I don't understand why it does that, since it has a <code>whereGreaterThanOrEqualTo</code> method too, using the <code>gte</code> <em>(greater than or equal to)</em> <em>Parse</em> parameter.</p>
  <h3>TL;DR</h3>
  <p><strong>greater than</strong> <em>(<code>gt</code>)</em> parameter behaves exactly like <strong>greater than or equal to</strong> <em>(<code>gte</code>)</em> parameter.</p>