public static function update($id, $document, $connection)
    {
        $from = $connection->db;
        if (strpos($from, '.') !== false) {
            $tmp = explode('.', $connection->db);
            $from = end($tmp);
        }

        $connection->method = 'PATCH';
        $connection->action = '['.urlencode($id).']';
        switch (gettype($document)) {
            case "string":
                $connection->query = $document;
                break;
            case "array":
            case "object":
                $connection->method = 'POST';
                $connection->action = '/_query';
                $connection->query = 'UPDATE '.$from.'["'.$id.'"] SET '.self::updateRecursion($document);
                break;
            default:
                throw new ClusterpointException("\"->update()\" function: parametr passed ".json_encode(self::escape_string($document))." is not in valid format.", 9002);
                break;

        }
        return self::sendQuery($connection);
    }