Skip to content

Commit

Permalink
Fix empty binary storage
Browse files Browse the repository at this point in the history
  • Loading branch information
AlekSi committed Feb 23, 2024
1 parent 1eba0f3 commit f374ef1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/bson2/bson2.go
Expand Up @@ -213,6 +213,12 @@ func convertToTypes(v any) (any, error) {
case string:
return v, nil
case Binary:
// Special case to prevent it from being stored as null in sjson / logged as null in fjson.
// TODO https://github.com/FerretDB/FerretDB/issues/260
if v.B == nil {
v.B = []byte{}
}

return types.Binary{
B: v.B,
Subtype: types.BinarySubtype(v.Subtype),
Expand Down

0 comments on commit f374ef1

Please sign in to comment.