Mongolid\Cursor\Cursor::sort PHP Method

sort() public method

Sorts the results by given fields.
public sort ( array $fields ) : Cursor
$fields array An array of fields by which to sort. Each element in the array has as key the field name, and as value either 1 for ascending sort, or -1 for descending sort.
return Cursor Returns this cursor.
    public function sort(array $fields)
    {
        $this->params[1]['sort'] = $fields;
        return $this;
    }