The documentation for the bson
package states the following:
uint, uint32, and uint64 marshal to a BSON int32 if the value is between math.MinInt32 and math.MaxInt32, inclusive, and BSON int64 otherwise.
But for some reason, uint
always marshals into bson int64. On the other hand int
behaves as excepted.
Here you can find a working example of the problem. It seems like a really simple thing I am probably missing, so I am currently not opening an issue.
Turns out the documentation was indeed wrong. This issue was created in response to my question.
Since it seems the documentation will be updated, I guess this question can be closed if moderators think it is no longer necessary.