t***@tenfy.cn
t***@tenfy.cn
  • 发布:2025-02-20 00:54
  • 更新:2025-02-20 11:28
  • 阅读:34

【报Bug】删除阿里云唯一索引后,还是会还是会唯一索引冲突

分类:uniCloud

产品分类: uniCloud/支付宝小程序云

操作步骤:
  1. 在云数据库创建一个document表,内容如下:
{  
    "bsonType":"object",  
    "required":[  

    ],  
    "permission":{  
        "read":false,  
        "create":"auth.uid != ''",  
        "update":false,  
        "delete":false  
    },  
    "properties":{  
        "_id":{  
            "description":"ID,系统自动生成"  
        },  
        "file_path": {  
            "bsonType": "sting",  
            "description": "上传的文件对象"  
        },  
        "cloud_path": {  
            "bsonType": "string",  
            "description": "云端路径"  
        },  
        "extname": {  
            "bsonType": "string",  
            "description": "文件后缀"  
        },  
        "name": {  
            "bsonType": "string",  
            "description": "文件名"  
        },  
        "file_id": {  
            "bsonType": "string",  
             "description": "对象存在文件id"  
        },  
        "file_size":{  
            "bsonType":"int",  
            "description":"文件大小"  
        },  
        "md5": {  
            "bsonType": "string",  
            "description": "文件md5"  
        },  
        "create_by":{  
            "bsonType":"string",  
            "description":"创建人",  
            "foreignKey":"uni-id-users._id",  
            "forceDefaultValue": {  
                "$env": "uid"  
            }  
        },  
        "create_time":{  
            "bsonType":"timestamp",  
            "description":"创建时间",  
            "forceDefaultValue": {  
                "$env": "now"  
            }  
        }  
    }  
}  
  1. 对file_id创建一个唯一索引

  2. 往有里插入一段数据

    {  
    "name": "1.png",  
    "extname": "png",  
    "file_id": "cloud://env-00jxt5rg35pe/1739622126156_0.png",  
    "create_by": "67b050c4c7286954d4594fb5",  
    "file_path": "blob:http://localhost:5174/a2da7bfa-f39e-454f-ba7f-7c0bba369a38",  
    "file_size": 2260511,  
    "cloud_path": "1739622126156_0.png",  
    "create_time": 1739622129122  
    }
  3. 删除唯一索引

  4. 再创建第3步的数据

预期结果:

预期可以插入数据。

实际结果:

实际会报 Business Failed, 参数有误document is already exists. traceId: 0b2537ec17399839987401546ef922

bug描述:

开发过程中,对document表的file_id建了唯一索引,然后把唯一索引删除后,再创建相同file_id的数据,会报 document is already exists

2025-02-20 00:54 负责人:无 分享
已邀请:
DCloud_uniCloud_VK

DCloud_uniCloud_VK

索引生效和删除有延迟,过3小时后再测试试试

要回复问题请先登录注册