|
@@ -139,6 +139,9 @@ func (r *tcpforwardingRepository) EditTcpforwardingIps(ctx context.Context, req
|
|
update := bson.M{"$set": updateData}
|
|
update := bson.M{"$set": updateData}
|
|
err := collection.UpdateOne(ctx, bson.M{"tcp_id": req.TcpId}, update)
|
|
err := collection.UpdateOne(ctx, bson.M{"tcp_id": req.TcpId}, update)
|
|
if err != nil {
|
|
if err != nil {
|
|
|
|
+ if errors.Is(err, mongo.ErrNoDocuments) {
|
|
|
|
+ return fmt.Errorf("记录不存在")
|
|
|
|
+ }
|
|
return fmt.Errorf("更新MongoDB文档失败: %w", err)
|
|
return fmt.Errorf("更新MongoDB文档失败: %w", err)
|
|
}
|
|
}
|
|
|
|
|