微信小程序云开发中对读取到的数据库某记录修改后再更新记录,怎么实现?

现在我需要对云开发的数据库记录进行更新,具体操作是,把记录中的那个字段数组拿出来,删除数组中的某个值,再将这个新的数组更新到字段中去,实现替换。
下面的贴图是数据库中要更新的内容:
图片说明

执行云函数时,遇到问题 : 数据拿到了,数组中的那个3也删除了,但是没有走更新那一步!
代码如下(代码是测试代码):

exports.main = async (event, context) => {
    return await db.collection('company').where({
        cNumber:9091190
    })
    .field({
        cPeople:true
    }).get()
    .then(res=>{
        console.log(res.data[0].cPeople)
        var peoplearry = res.data[0].cPeople;
        var arry;
        for(var i=0;i<peoplearry.length;i++){
            console.log(i)
            if (peoplearry[i] == 3){
                console.log('shanchu')
                peoplearry.splice(i,1)
            }
        }
        arry = peoplearry;
        try{
            console.log(arry)
            db.collection('company').where({
                cNumber: 9091190
            })
                .update({
                    data: {
                        cPeople: arry
                    },
                    success: console.log,
                    fail: console.error
                })
        }catch(e){
            console.error(e)
        }
    })
    .catch(console.error)


}

走到console.log(arry)这里,就不往下走了,没有更新到,在想是不是一个云函数中只能对数据库操作一次??
新手刚接触微信小程序,希望大神指点一下

数据没看明白数组在哪里不过可以给你一个完整的demo
特意写了个博客没看懂或者有其他疑问可以博客留言或者私聊
https://blog.csdn.net/weixin_43365995/article/details/88840596

必须云函数吗?本地函数是否也可以