Can't insert document into the collection

I’m trying to insert document to the collection and get error:

memdqpackets.go:192: Collection ID refresh failed: invalid argument | {"status_code":4,"bucket":"go-services","error_name":"EINVAL","error_description":"Invalid packet","opaque":7,"context":"Request must include key","last_dispatched_to":"*******:11210","last_dispatched_from":"10.1.1.8:60657","last_connection_id":"108c1154baa414e6/d220901c40037cae"}

Code example:

bucket.Scope("brand").Collection("brand").Insert("key", "val", nil)

When i uses github.com/couchbase/gocb/v2@v2.2.1 insert is successful. The error reproduces from github.com/couchbase/gocb/v2@2.2.3. The code also works if i use collection “_default”. Server version: 7.0.0-beta.

Hi @alex_k unfortunately v2.2.3 does not work with server 7.0 beta when using named collections. Due to a late change on the server side we had to update the way that the SDK encodes the packet when looking up a collection ID. This change made the SDK no longer compatible with the beta. I can’t recall if the change happened in v2.2.2 or v2.2.3, but until 7.0 GA is released you’ll have to stick with an earlier version.

Until this is resolved, you can use the _default scope and collection. You can later rename these when the integration works as expected. I’ve done this to allow me to continue plumbing the needed configuration in my app without hitting this issue.

Example:

col, err := cb.Collection("myBucketName", "_default", "_default")

I hope this is helpful.