Answers for "golang struct to bson.d"

Go
0

golang struct to bson.d

func toDoc(v interface{}) (doc *bson.Document, err error) {
    data, err := bson.Marshal(v)
    if err != nil {
        return
    }

    err = bson.Unmarshal(data, &doc)
    return
}
Posted by: Guest on May-05-2020

Code answers related to "golang struct to bson.d"

Browse Popular Code Answers by Language