MongoDB Extended JSON (v2) "$numberDouble" not working


I have a "numberInput" field with value of zero (0) (or whatever). I want this value to be represented as a double number in mongodb.

I messed with lodash _.toNumber(0).toFixed(2) and stuff like this, it simply will not store it as double in mongodb. It's either gets to be string or int32. I don't want to rewrite my json validators in mongodb just for this (to allow both types int32 and double).

# insertOne query
  weight: {
    "$numberDouble": "10.5"

This returns an error: " key $numberDouble must not start with '$'

If I use "$numberDecimal" or "$numberLong" that works.

What is wrong with "$numberDouble"?



Hey @gorkhaan, thank you for bringing this to our attention. I can confirm that this is a bug and have filed a report internally. I've attached this post to the report and will notify you here of any updates on our end. Thanks again for flagging this and sorry for the inconvenience this has caused you!