[CSHARP-2560] The BsonDocument doesn't equal to itself when has double.NaN value in it. Created: 25/Mar/19  Updated: 31/Mar/22

Status: Backlog
Project: C# Driver
Component/s: BSON
Affects Version/s: 2.8.0
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Tom Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

C# MongoDB Driver 2.8.0
.Net Framework 4.6.1



 Description   

This piece of code print False:

var bd = new BsonDouble(double.NaN);
var be = new BsonElement("test", bd);
var document = new BsonDocument(be);

Console.WriteLine(document.Equals(document));

 

//This cause the BsonDocument can't be removed from a list.

var list = new List<BsonDocument>();

list.Add(document);
list.Remove(document);  //Nothing happened here.

 



 Comments   
Comment by Ian Whalen (Inactive) [ 25/Mar/19 ]

hey tom3000 thanks for the report. the definition of double.NaN is that two NaN values are not equal to each other, so we'll need to think about whether two BsonDocuments containing NaNs should be equal or not.

Generated at Wed Feb 07 21:42:53 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.