I'm writing a Firebase cloud function that creates a "Multi-player Room" object in the Real-time Database for my multi-player game. I use databaseReference.push()
to write the room in the database with a unique ID, but I need to get that ID and store in the room object too.
What I get:
{
multiplayer_games:{
-SOME_ID:{
some_value:***,
some_other_value:***
}
}
}
What I need:
{
multiplayer_games:{
-SOME_ID:{
id:-SOME_ID,
some_value:***,
some_other_value:***
}
}
}
So how can I get that random push ID and use it?