typesense / typesense-go

Go client for Typesense: https://github.com/typesense/typesense
Apache License 2.0
208 stars 55 forks source link

fix: partial document update with 201 status code #151

Closed danidomi closed 7 months ago

danidomi commented 9 months ago

Change Summary

when partial update happens for a document, e.g. below the return is a 201, showned in the logger

updatePayload := map[string]interface{}{
    field: value,
}

_, err := r.client.Collection(collection).Document(documentID).Update(updatePayload)
if err != nil {
    fmt.Println(err)
    log.Error().Err(err).
        Interface("dd.trace_id", span.Context().TraceID()).
        Interface("dd.span_id", span.Context().SpanID()).
        Msg("failed to update document")
    return err
}

log

status: 201 response: {"followers_count":1,"id":"20542911","is_banned":false,"is_live":false,"slug":"danidomi","username":"danidomi","verified":false}
{"level":"error","error":"status: 201 response: {":\"danidomi\",\"username\":\"danidomi\",\"verified\":false}","dd.trace_id":830451322171203481,"dd.span_id":830451322171203481,"time":"2023-12-09T16:49:45Z","message":"failed to update document"}

PR Checklist

gdevillele commented 8 months ago

Thanks a lot! This looks good. 👍