I am currently using ArrayUnion
to update an Array in a Document in Firebase. It Consists of a Map of the format {userid:XXXXXX,value:01234}
. Now lets say I want to change this value, I was initially thinking of just using ArrayUnion and send an updated map, But how do I remove the pre-existing Map. (In Other Words No Too Map in the array can have the same ID).
Seems like a long shot, but I was also thinking maybe we can just use a Map which has a timestamp attribute to showing when it was added, and then on the client side ill perform the actions of removing those entries which are older.
Which of the options is better? and do you have any better solutions for the same problem?
(Note: Using Firebase v9 for Web)