hello,
i leveraged v2.0 for golang sdk and was able to leverage connect & bucket to make a connection & get the bucket info. however, i couldnt retrieve document by id and wondering if there is a way to get document by id
i have this so far
package main
import (
“fmt”
gocb "github.com/couchbase/gocb/v2"
)
func main() {
bucketName := “bucket”
opts := gocb.ClusterOptions{
Username: “username”,
Password: “password”,
SecurityConfig: gocb.SecurityConfig{
TLSSkipVerify: false,
},
}
cluster, err := gocb.Connect("couchbase://host:port”, opts)
if err != nil {
fmt.Println("Error in cluster connection", err)
}
bucket := cluster.Bucket(bucketName)
collection := bucket.DefaultCollection()
coldoc, cerr := collection.Get(“doc_id”, &gocb.GetOptions{})
if err != nil {
fmt.Println("coldoc err", cerr)
}
fmt.Println("coldoc", coldoc)
}
i get document as nil . wondering if there is a way to retrieve doc details .
thanks
chakri