【发布时间】:2019-08-05 07:13:18
【问题描述】:
所以我目前正在使用 Cloud Functions。我正在做的是这样的:
export const onMessageCreate = functions.database.ref('/Users/{user}/{message}/{text}').onCreate((snapshot, context) => {
const data = snapshot.val()
const changedData: string = change(byteData.text)
return snapshot.ref.update({id: compressedByteData}) //This is the problem
})
change(input: string): string 是我的一个自定义函数,它只是用生日蛋糕表情符号替换每个出现的生日快乐这个词。然而,在我的参考文献中看起来像这样:"/Users/{user}/master/{messageGroup}/content/{message}" 我想更新文本的值。但是,因为我不知道{text} 是什么,所以我无法将它存储在正确的位置。有人有什么建议吗?
change() 函数是:
function change(data:string):string {
return data.replace(/\bhappy-birthday\b/g, '????')
}
这是 Firebase 节点图片: Firebase Node Setup
所以我想用我的 Cloud Functions 更改 01、02、03(值无关紧要)。
我想做什么的视觉表示: Visual Representation
【问题讨论】:
标签: javascript typescript firebase google-cloud-functions