package mongoext import ( "reflect" "go.mongodb.org/mongo-driver/v2/bson" ) func CreateGoExtBsonRegistry() *bson.Registry { reg := bson.NewRegistry() // otherwise we get []bson.E when unmarshalling into any // which will result in {'key': .., 'value': ...}[] json when json-marshalling reg.RegisterTypeMapEntry(bson.TypeEmbeddedDocument, reflect.TypeFor[bson.M]()) return reg }