type User struct {
ID primitive.ObjectID `bson:"_id,omitempty"`
CreatedAt time.Time `bson:"created_at"`
UpdatedAt time.Time `bson:"updated_at"`
Name string `bson:"name"`
}
user := User{Name: "username"}
client.Database("db").Collection("collection").InsertOne(context.Background(), user)
如何在golang的mongodb(仅限mongodb驱动程序)中使用上述代码中自动创建的_at和更新的_at?目前,它将为在创建的_和在更新的_设置零时间(0001-01-01T00:00:00.000+00:00).