Sokil\Mongo\Cursor::getHash PHP Method

getHash() public method

Used to get hash that uniquely identifies current query
public getHash ( )
    public function getHash()
    {
        $hash = array();
        // expression
        $hash[] = json_encode($this->expression->toArray());
        // sorts
        if ($this->sort) {
            $sort = $this->sort;
            ksort($sort);
            $hash[] = implode('', array_merge(array_keys($sort), array_values($sort)));
        }
        // fields
        if ($this->fields) {
            $fields = $this->fields;
            ksort($fields);
            $hash[] = implode('', array_merge(array_keys($fields), array_values($fields)));
        }
        // skip and limit
        $hash[] = $this->skip;
        $hash[] = $this->limit;
        // get hash
        return md5(implode(':', $hash));
    }