title: Push Notification from Firestore
body: <p>I need to send notification when data change in my Cloud Firestore database. I have this fields <a href="https://i.stack.imgur.com/wAXwi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wAXwi.png" alt="enter image description here"></a></p>
  
  <p>I need to get the all users tokens and send the push notification. I have a code, but this only give me a token if i know the user name this is my code :</p>
  
  <pre><code>const functions = require('firebase-functions');
  const admin = require('firebase-admin');
  admin.initializeApp();
  
  exports.useWildcard = functions.firestore
      .document('notification/{id}')
      .onWrite((change, context) =&gt; {
  
          const payload = {
              notification: {
                  title: 'Message from Cloud',
                  body: 'This is your body',
                  badge: '1',
                  sound: 'default'
              }
          };
  
          admin.firestore().collection('notification').doc('fcm-token').get().then(doc =&gt; {
              console.log("Token: " + doc.data().user1.token);
          });
  
      });
  </code></pre>