Skip to content

Commit 7326b69

Browse files
refactor: Add omitempty to the bson tag for the ID field of the Model struct
1 parent 2cbe9d8 commit 7326b69

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

model.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131
// mongox.Model
3232
// }
3333
type Model struct {
34-
ID primitive.ObjectID `bson:"_id"`
34+
ID primitive.ObjectID `bson:"_id,omitempty"`
3535
CreatedAt time.Time `bson:"created_at"`
3636
UpdatedAt time.Time `bson:"updated_at"`
3737
}

0 commit comments

Comments
 (0)