public function each($callback, $useMasterKey = false, $batchSize = 100)
    {
        if ($this->orderBy || $this->skip || ($this->limit >= 0))
        {
            throw new \Exception("Cannot iterate on a query with sort, skip, or limit.");
        }
        $query = new AVQuery($this->className);
        $query->where = $this->where;
        $query->includes = $this->includes;
        $query->limit = $batchSize;
        $query->ascending("objectId");

        $finished = false;
        while (!$finished)
        {
            $results = $query->find($useMasterKey);
            $length = count($results);
            for ($i = 0; $i < $length; $i++)
            {
                $callback($results[$i]);
            }
            if ($length == $query->limit)
            {
                $query->greaterThan("objectId", $results[$length - 1]->getObjectId());
            } else
            {
                $finished = true;
            }
        }
    }