How to add new fields to existing document using go sdk

The register structure below captures the data coming from the registration UI:
register struct {
Email string
Password string }

The collection.insert command creates the following document:
{ “id”: “1”,
“email” : “john@example.com”,
“password” : “pwd”
}

The demographics struct captures the data coming from Demographics UI:
demographics struct {
Name string
Address string
}

I want to update the document so the resulting document is as follows:
{ “id”: “1”,
“email” : “john@example.com”,
“password”: “pwd”,
“name” : “John Doe”,
“address” : “100 Main Street”
}

Using N1QL I could write the following:
Update bucket set name=“John Doe”, address=“100 Main Street” where id=“1”

I couldn’t find update API in go sdk.
How to do this using go sdk?
Thanks!

Hi @Tushar_Kale,

You can do partial updates with the Sub-Document APIs:
https://docs.couchbase.com/go-sdk/2.0/howtos/subdocument-operations.html#mutating