-
Type: Bug
-
Resolution: Works as Designed
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.10.4
-
Component/s: BSON
-
None
-
Environment:.net framework 4.7.2
-
(copied to CRM)
var document = new BsonDocument {
{ "double1", 0.5710711036366942 } ,
{ "double2", 1.1897551732621 } ,
{ "double3", 1.680586318655911 } };
var jsonDoc = document.ToJson();
Console.WriteLine(jsonDoc);
This default extension methods ToJson will output:
{ "double1" : 0.57107110363669422, "double2" : 1.1897551732620999, "double3" : 1.6805863186559109 }
while insert this bson document into MongoDB won't introduce the discrepancy, the ToJson method will change the valid double values.
1. Could this be resolved by customized IBsonSerializer or JsonWriterSettings?
2. Is it more reasonable to keep the same value in default ToJson() ?
Thanks for the time and efforts in advance.