I am sending a notification using a device token with Cloud Firestore and Cloud Function. Now the system will store the device token in which user logs in. Since a user may have multiple device or may logged in using different device, all I want is to send this notification to those device using the stored device token. This is how a users document looks like, I store the tokens as a nested object.
{
name: "Frank Kemerut",
device_tokens: { 23qweq: "LG G6", Os23pk: "Samsung S6", asd231: "Samsung S9" },
age: 12
}
Now I want to iterate and get all key and value then send a notification to those device using the collected tokens. How am I going to perform this? Is this the best approach?