如果在 Firestore 中找到数据,我将尝试退出该功能
var flag= admin.firestore().collection('video').doc(thumbnailName);
var getDoc = flag.get()
.then(doc => {
if (doc.exists) {
console.log('exit process');// data found in firestore exit frm here
process.exit();
return null;// doesnt work here
}
else {
console.log('create data in firestore');// do some work here
}
})
.catch(err => {
console.log('Error getting document', err);
});
return null 似乎在 then 范围内不起作用
我得到的错误是
process.exit() 完成状态:“连接错误”