Convert Double -> Int and Int -> Double as necesary

This implements the code needed for #1 .

This raises all the issues of inaccuracy in conversion, but in Practice, MongoDB itself already botches things up. :(