Int32 converted to double during "Copy Document" if 'Show Int32 as NumberInt('xxx') is off

Carl Bussema shared this problem 2 years ago
Solved

Using MongoBooster 3.5.7

Sample document showing the correct data structure. lastStatusUpdate should deserialize to a C# DateTimeOffset which is basically a tuple of Ticks, OffsetMinutes and requires those to be Int64 and Int32 respectively.

{
	"_id" : "1234",
	"lastStatusUpdate" : [
		NumberLong("636383428184095648"),
		NumberInt("0")
	]
}
From the Options menu, under Result JSON View Format, turn OFF "Show Int32 as NumberInt("xxx")"

After inserting the above document, find it in the tree view and right-click it, choose "Copy Document to Clipboard"

Paste onto a blank tab, notepad, whatever and examine the resulting JSON. Notice that the NumberInt() around the 0 is removed, so if you insert this document, you get a double instead of Int32, and will break your deserialization.

{
	"_id" : "1234",
	"lastStatusUpdate" : [
		NumberLong("636383428184095648"),
		0
	]
}
Workaround: Enable Show Int32 as NumberInt("xxx")

Comments (2)

photo
1

Thank you for your bug report. We will fix it in the next build.

photo
1

Resolved in V4.0.1