fix:mgo delete err (#2496)

pull/2548/head
qinguoyi 3 months ago committed by GitHub
parent 97f4b51874
commit f44a97b8d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -167,6 +167,10 @@ func (u *UserMgo) DeleteUserCommand(ctx context.Context, userID string, Type int
filter := bson.M{"userID": userID, "type": Type, "uuid": UUID}
result, err := collection.DeleteOne(ctx, filter)
// when err is not nil, result might be nil
if err != nil {
return errs.Wrap(err)
}
if result.DeletedCount == 0 {
// No records found to update
return errs.Wrap(errs.ErrRecordNotFound)

Loading…
Cancel
Save