This is extension for officional MongoDB Go driver adds support for Google protocol buffers types.
It contains set of BSON marshal/unmarshal codecs for Google protocol buffers type wrappers, Timestamp and MongoDB ObjectID:
BoolValue
BytesValue
DoubleValue
FloatValue
Int32Value
Int64Value
StringValue
Uint32Value
Uint64Value
Timestamp
ObjectID
- Official MongoDB Go Driver: https://go.mongodb.org/mongo-driver
- Google protocol buffers types (wrappers): https://github.com/golang/protobuf/blob/master/ptypes/wrappers/wrappers.proto
- Google protocol buffers Timestamp type: https://github.com/golang/protobuf/blob/master/ptypes/timestamp/timestamp.proto
- MongoDB ObjectID type: https://github.com/mongodb/mongo-go-driver/blob/master/bson/primitive/objectid.go
- MongoDB ObjectID my proto wrapper: https://github.com/amsokol/mongo-go-driver-protobuf/blob/master/proto/mongodb/objectid.proto
- Google protocol buffers version
proto3
- Official MongoDB Go Driver RC1 or higher
Installing using go get
:
go get -u github.com/amsokol/mongo-go-driver-protobuf
or you don't need to do anything manually if you are using Go modules. Go modules installs necessary packages automatically.
First install protoc-gen-gotag
to make available Go language tags
for proto messages
go get -u github.com/amsokol/protoc-gen-gotag
Next
- Create free Altas mini MongoDB instance
- Create
experiments
database - Create
proto
collection intoexperiments
database - Run this example