i need to get an item from a set returned from
resource.data.diff(request.data).changedKeys()
so, is there a way to get an item from a set, or turn a set into a list to get an item?
I don't need to compare any values, so i don't need hasOnly()
or any related functions, i need to get one of the values in a set, any way to do this?
I raised a ticket to Firebase support to make Set's values accessible as soon as Set was added to the API. Still waiting...
The workaround I use is request.writeFields
, which contains all the fields that are written to for a given create/update.
Note:
request.writeFields
is deprecated and may be removed (crazy in my opinion when there is no other workaroung available)
For nested fields it will give you the full path for each field For instance if you update the following fields in your doc:
{
A // UPDATED
B: {
BA
BB // UPDATED
}
C: {
CA: {
CAA // UPDATED
}
CB
}
}
=> request.writeFields
= ['A', 'A.BB', 'C.CA.CAA']
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With