As you know, 3.14 and new Number(3.14) are same in Javascript, but typeof(3.14) == 'number' and typeof(new Number(3.14)) == 'object', the writeElement function in bson.js doesn't process the second situation, including Number, String and Boolean.
http://bonsaiden.github.com/JavaScript-Garden/zh/#types.typeof