Currently we have bson.SetJSONTagFallback to fallback to json tag when no bson tag available, which is pretty useful when using protobuf with mgo, leave generated *.pb.go untouched and get a consistent field name between json & bson.
With the default omitempty tag generated by protobuf, updated struct fields with empty values will not be encoded, leave the database untouched. Adding a switch for ignoring omitempty will gain another benefit that we can keep protobuf performant and make updating operations easier.
Currently we have
bson.SetJSONTagFallback
to fallback to json tag when no bson tag available, which is pretty useful when usingprotobuf
withmgo
, leave generated*.pb.go
untouched and get a consistent field name between json & bson.With the default
omitempty
tag generated byprotobuf
, updated struct fields with empty values will not be encoded, leave the database untouched. Adding a switch for ignoringomitempty
will gain another benefit that we can keepprotobuf
performant and make updating operations easier.