diff --git a/marshal.go b/marshal.go index c07b042..03d45e4 100644 --- a/marshal.go +++ b/marshal.go @@ -47,6 +47,8 @@ func Marshal(in interface{}) (interface{}, error) { return marshalTimestamp(v), nil case bson.RegEx: return marshalRegex(v), nil + case bson.Decimal128: + return marshalDecimal128(v), nil case string, int, int64, bool, float64, uint8, uint32: return v, nil default: @@ -111,3 +113,9 @@ func marshalRegex(in bson.RegEx) map[string]interface{} { "$options": in.Options, } } + +func marshalDecimal128(in bson.Decimal128) map[string]interface{} { + return map[string]interface{}{ + "$decimal128": in.String(), + } +}