go-zero
go-zero copied to clipboard
monc cache is bug
Describe the bug data.id.hex is nil
-
The code is
func (m *defaultUserModel) FindOne(ctx context.Context, id string) (*User, error) { oid, err := primitive.ObjectIDFromHex(id) if err != nil { return nil, ErrInvalidObjectId }
var data User
key := prefixUserCacheKey + data.ID.Hex()
err = m.conn.FindOne(ctx, key, &data, bson.M{"_id": oid})
switch err {
case nil:
return &data, nil
case monc.ErrNotFound:
return nil, ErrNotFound
default:
return nil, err
}
}
- OS: [e.g. Mac]
- go-zero version [e.g. 1.3.4]
- goctl version [e.g. 1.3.8, optional]
**More description**
Add any other context about the problem here.
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.