-
Type: New Feature
-
Resolution: Won't Fix
-
Priority: Minor - P4
-
None
-
Affects Version/s: 3.0.0
-
Component/s: BSON
-
None
-
Environment:All
For below code
Document("a", 12).append("b", 14l).toJson()
The output is
{ "a" : 12, "b" : { "$numberLong" : "14" } }
If we change code as
Document("a", 12).append("b", 14l).toJson(new JsonWriterSettings(JsonMode.SHELL))
It generates
{ "a" : 12, "b" : NumberLong(14) }
However in some circumstance, we expect to get the simple
{ "a" : 12, "b" : 14 }.
In the implementation of JsonWriter.doWriteInt64(), there is a default switch case for such output, but it never goes there because JsonMode has only two exact enum value.
So please add one new enum value for JsonMode, and then we can write code as
Document("a", 12).append("b", 14l).toJson(new JsonWriterSettings(JsonMode.NEW_VALUE))
and then can get the simple output
{ "a" : 12, "b" : 14 }