Skip to content

Commit 788a54f

Browse files
Merge pull request #37 from chenmingyong0423/feature/refactor
refactor: Add omitempty to the bson tag for the ID field of the Model struct
2 parents ab6d3c1 + 7326b69 commit 788a54f

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)