go-couchbase客户端更新功能

I am using the Update function of go-couchbase

//defining the function first and passing it as an argument
myfunc := func(current []byte)(updated []byte, err error) {return updated, err }
myb.Update("key123", 1, myfunc)

However, when I run the Update function of the bucket. I checked the couch database. The document with the key of "key123" was disappeared. It seems the Update does not update the value but delete it. What happened? Am I doing something not correct?

func (*Bucket) Update

func (b *Bucket) Update(k string, exp int, callback UpdateFunc) error

Update performs a Safe update of a document, avoiding conflicts by using CAS.

The callback function will be invoked with the current raw document contents (or nil if the document doesn't exist); it should return the updated raw contents (or nil to delete.) If it decides not to change anything it can return UpdateCancel as the error.

If another writer modifies the document between the get and the set, the callback will be invoked again with the newer value.

Your UpdateFunc:

myfunc := func(current []byte)(updated []byte, err error) {return updated, err }

You do not set updated []byte to a value before you return it. Therefore, it has its zero value nil, a request to delete: "The callback function should return the updated raw contents (or nil to delete.)"