zookzook / elixir-mongodb-driver

MongoDB driver for Elixir
Apache License 2.0
245 stars 63 forks source link

Add missing decoder case for NaN #251

Closed danieka closed 2 months ago

danieka commented 2 months ago

When running against our Mongo instance we got the following error:

%FunctionClauseError{module: BSON.Decoder, function: :type, arity: 2, kind: nil, args: nil, clauses: nil}

Turns out that, at least for our Mongo installation, this case is used for NaN. I have validated that the value is NaN in Mongo Compass and adding this case results in the document being deserialised to the same values as in Compass.

zookzook commented 2 months ago

This is interesting. Could you provide the version of the MongoDB? The only different is, that the sign bit is set to 1.

zookzook commented 2 months ago

Thank you!

danieka commented 2 months ago

@zookzook We use MongoDB 7.3.3 Enterprise, but this could also be related to the library we use for writing to Mongo, but I don't know what we use there.