优化mongo,封装count逻辑,处理objectId

This commit is contained in:
2026-01-06 17:41:47 +08:00
parent 213ad95791
commit 40c5d5de79

View File

@@ -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 {