convert result into JSON without structs using mongo-go-driver
问题 I don't want to use structs before converting results into JSON. Let's say I have some results: result, err := collection.Find(ctx, filter, options) I can collect all results in docs variable and last result in doc variable: var doc bson.Raw var docs []bson.Raw for result.Next(ctx) { document, err := result.DecodeBytes() if err != nil { log.Println(err) } doc = document docs = append(docs, doc) } I can easily convert last result into JSON without using any structs: var jsonDoc bson.M err =