Skip to content

forexamples/mongo-go-driver-uint64

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

BSON Serialization fail with uint64

package main

import (
	"math"
	"testing"

	"go.mongodb.org/mongo-driver/bson"
)

func TestMarshal_Bson_UInt64(t *testing.T) {
	type testObj struct {
		Value uint64 `bson:"value"`
	}
	obj := testObj{
		Value: math.MaxInt64 + 1,
	}
	_, err := bson.Marshal(obj)
	if err != nil {
		t.Errorf("bson marshal failed: %v", err)
	}
}
$ go test ./...
--- FAIL: TestMarshal_Bson_UInt54 (0.00s)
    main_test.go:19: bson marshal failed: 9223372036854775808 overflows int64
FAIL
FAIL	bson-uint64	0.001s
FAIL

About

bson in mongo-go-driver does't support uint64

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages