Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnmarshalBSON and MarshalBSON serialization #165

Open
1140251 opened this issue Jun 22, 2021 · 2 comments
Open

UnmarshalBSON and MarshalBSON serialization #165

1140251 opened this issue Jun 22, 2021 · 2 comments

Comments

@1140251
Copy link

1140251 commented Jun 22, 2021

when saving to mongodb with mongo go driver, the decimal.Big is created with an empty context only.
Maybe you don't want this dependency, but how can serialize this?

As a workaround I'm saving as Float64 and converting to decimal.Big when performing operations, but is not the most eloquent way for me.

@ericlagergren
Copy link
Owner

Could you elaborate a little bit more?

@trading-peter
Copy link

I think he means that when saving a decimal.Big in mongodb this is the result that is written into the db.
image
I'm too wondering if it would make if this library would support marshaling into (I guess) a Decimal128 as supported by mongodb.

https://github.com/mongodb/mongo-go-driver/blob/master/bson/primitive/decimal.go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants