The interface written by express+mongoose will report an error the second time it is requested.

exports.del = function(req, res){
     var id = req.body.id;
    if(id){
        Label.findById({_id : id}, function(err, label){
            if(err) {console.log(err)}
            let labelName = label.labelName;
            if(!labelName){
                for(let item of label.articleList){
                    (function(item){
                        console.log("fisrt:"+ item)
                        Article.findOne({articleTitle : item}, function(err, article){
                            let labelArr = article.articleLabel;
                            let index      = labelArr.findIndex(function(label){
                                                            console.log(label, item)
                                                            return label == labelName
                                                        })
                            labelArr.splice(index, 1)
                            article.save(function(err, article){
                                if(err){ console.log(err)}
                            })
                        })
                    })(item) 
                }
            }
        }) 
        Label.remove({_id : id}, function(err, label){
            if(err){console.log(err)} 
             Label.fetch(function(err, label){
                if(err){
                    console.log(err)
                }
                    res.json(label)
                })   
        })
    }
}

when this interface is requested for the second time, the following error
TypeError: Cannot read property "labelName" of null

I really don"t have a deep understanding of js and node. I hope someone can help me explain and why? Thank you

Mar.21,2021

solved it on its own.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eab77a-697cc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eab77a-697cc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?