DEV Community

Discussion on: MongoDB Golang Driver Tutorial

Collapse
 
tisoportes profile image
tisoportes

Hi!

Pretty cool all samples, thanks.

What about if I have:

type Hero struct {
MyVar1 bool json:"signed" bson:"signed"
MyVar2 string json:"alias" bson:"alias"
MyVar3 string json:"name" bson:"name"
}

How can I get its _id? Should I declare in the structure? I've tried but I cannot figure out. Just starting with mongo in go and your samples are very useful.

Thanks!