Elfocrash / Cosmonaut

🌐 A supercharged Azure CosmosDB .NET SDK with ORM support
https://cosmonaut.readthedocs.io
MIT License
341 stars 44 forks source link

Doubles are being rounded... #27

Closed leonpotgieter closed 6 years ago

leonpotgieter commented 6 years ago

Hi, noticing something strange when writing doubles as fields/properties in a document... they always end up being rounded when written into the database.

Can't seem to find a way to prevent this... eventually had to switch the property to a string type and store it that way...

Elfocrash commented 6 years ago

Hello.

I just tested that and that doesn't seem to be the case. It must be rounded up at some point before it hits Cosmonaut. It could also be coming from JsonSettings being set somewhere.

image

Can you try doing that in a clean console app and see if it still happens because I cannot reproduce it.

Thanks

leonpotgieter commented 6 years ago

Hi Nick, thanks for confirming it works your side. I'm literally setting the double value in the record and then doing an UpsertAsync() on the next line... Will investigate further. Tx

Elfocrash commented 6 years ago

I just tested Upsert and it seems to be working as well.

Could you please download the code that can be found in the sample folder, add this property on any of the DTO classes, run it and check the produced results?

public double TestDouble { get; set; } = new Random().NextDouble();

Thanks

Elfocrash commented 6 years ago

Closes this due to lack of info. Feel free to reopen if this is still an issue.