Closed newmanifold closed 1 month ago
It can be reproduced by simple snippet
package main import ( "fmt" "github.com/gagliardetto/solana-go" "go.mongodb.org/mongo-driver/bson" ) func main() { key := solana.MustPublicKeyFromBase58("4wBqpZM9k69W87zdYXT2bRtLViWqTiJV3i2Kn9q7S6j") type S struct { Address solana.PublicKey `bson:"address"` } v, _ := bson.Marshal(S{Address: key}) var s S err := bson.Unmarshal(v, &s) if err != nil { fmt.Println(err) } }
reason for the error is that PublicKey's UnmarshalBSONValue method calls bson.Unmarshal instead of bson.UnmarshalValue
UnmarshalBSONValue
bson.Unmarshal
bson.UnmarshalValue
It can be reproduced by simple snippet
reason for the error is that PublicKey's
UnmarshalBSONValue
method callsbson.Unmarshal
instead ofbson.UnmarshalValue