public static function orderBy($field, $order)
    {
        if (!$order) {
            $order = 'DESC';
        }
        $order = strtoupper($order);
        if (!($order=='ASC' || $order=='DESC')) {
            throw new ClusterpointException("\"->order()\" function: ordering should be DESC or ASC.", 9002);
        }
        if (!(gettype($field)=="string" || $field instanceof Key || $field instanceof Raw)) {
            throw new ClusterpointException("\"->order()\" function: passed field selector is not in valid format.", 9002);
        }
        if ($field instanceof Key) {
            $field =  self::field("{$field}");
        }
        return "{$field} {$order}";
    }