import (
"testing"
"github.com/mongodb/mongo-go-driver/bson"
"github.com/stretchr/testify/require"
)
func TestStructBson(t *testing.T) {
type ts struct {
Value interface{}
}
valMap := map[string]interface{}\{"a": 1}
instance := ts\{Value: valMap}
instanceByte, err := bson.Marshal(instance)
require.NoError(t, err)
var newInstance ts
err = bson.Unmarshal(instanceByte, &newInstance)
require.NoError(t, err)
var i interface{}
err = bson.Unmarshal(instanceByte, &i)
require.NoError(t, err)
t.Errorf("%v %v", instance.Value, newInstance.Value)
}