From 40c5d5de79cea56c2cca3206f163296dd6fe95b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=96=8C?= <259278618@qq.com> Date: Tue, 6 Jan 2026 17:41:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96mongo=EF=BC=8C=E5=B0=81?= =?UTF-8?q?=E8=A3=85count=E9=80=BB=E8=BE=91=EF=BC=8C=E5=A4=84=E7=90=86obje?= =?UTF-8?q?ctId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mongo/mongo.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mongo/mongo.go b/mongo/mongo.go index 2f75dc4..fcef51c 100644 --- a/mongo/mongo.go +++ b/mongo/mongo.go @@ -238,6 +238,9 @@ func (m *MongoDB) Find(ctx context.Context, filter bson.M, result interface{}, c optionsKey := fmt.Sprintf("%+v%+v", page, orderBy) redisKey := fmt.Sprintf(redis.List, user.TenantId, collection, filterKey, optionsKey) resultValue := reflect.ValueOf(result) + if resultValue.IsNil() || resultValue.IsZero() { + return errors.New("result不能为空") + } resultValue = resultValue.Elem() listField := resultValue.FieldByName("List") if m.Cache {