I wanted to update a badge count in a chat room using cloud function trigger which is a nested map. I'm updating badges in the frontend without any issue but I want the create a cloud function for this to reduce frontend workloads. but when I tried to pass a dynamic variable as field/key, the compiler is not happy and it's giving me an error.
the expected output should be like this
Backtick doesn't work so I tried to change the backtick to double quote to be able to compile, but this was the output which is not what i want.
anyone knows how to make this work? please help.
CodePudding user response:
its syntax issue, missing [
& ]
.
it should be { [`badgeCount.${receveid}`]: fire....
.