title: How do I update the data in my firebase real-time database with the existing data along side a randomly generated id
body: <p>I'm sending data from a form to my database. As I've understood correctly, using .push() creates a unique ID where my data is appended to and uploaded. I need to now get that same data and then add a new ID entry. But I can't reference the data since its stored under the unique ID created by the .push() method.</p>
  
  <pre><code>exports.addUser = functions.https.onRequest(async (req, res) =&gt; { //Adds data from the form to the database
    cors(req, res, async () =&gt; {
      // Grab the message body parameter.
      const entry = req.body;
      // Push the new message into the Realtime Database using the Firebase Admin SDK.
      const snapshot = await admin.database().ref('entries/users/').push(entry);
  
      console.log('my new shiny id is ' + snapshot.key());
      // Redirect with 303 SEE OTHER to the URL of the pushed object in the Firebase console.
      res.redirect(303, snapshot.ref.toString());
    })
  });
  
  //Function to generate a random ID and update into the entry from the form on the database.
  exports.generateID = functions.database.ref('entries/users/').onCreate((snapshot, context) =&gt; {
    console.log(snapshot.val());
    const original = snapshot.val();
    console.log(context);
    console.log(snapshot.key());
    const dev = '0eeb94ca-3426-46ca-964d-a9bdd7d00ef0';
    var random = Math.random().toString(36).substring(7);
    const code = uuidv5('user-' + random, dev);
    return snapshot.ref.update({
      userID: code
    });
  })
  </code></pre>
  
  <p>Here is an image of the data structure in my real-time database.
  <a href="https://i.stack.imgur.com/YZyg6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YZyg6.png" alt="database structure"></a></p>