How to marshal json string to bson document for writing to MongoDB?

后端 未结 3 452
野的像风
野的像风 2021-02-07 16:23

What I am looking is equivalent of Document.parse()

in golang, that allows me create bson from json directly? I do not want to create intermediate Go structs for marshal

3条回答
  •  感情败类
    2021-02-07 17:12

    There is no longer a way to do this directly with supported libraries (e.g. the mongo-go-driver). You would need to write your own converter based on the bson spec.

提交回复
热议问题