How to update Firebase Database

I am trying to update a Firebase realtime database of monthly emails I send out named "blogs" it uses the Year and month as the key to organize the info for example "2024-10". Here is the structure of the data:

I have a form created but I am not sure how to do the update on the data based on the YYYY-MM key. Here is what I have so far but I can't figure out whatto I put for Object to Set and it is not letting my insert Javascript Variables in this field. Can I do this with a Firebase Realtime Database Query, or do I need to write Javascript?

2 Likes

I would say it wouldn’t hurt to try and use JavaScript but you can create a JSON object to connect to your resource.

Here is an example JSON object. Modify or change it based on your preferences and needs.

{
"abstract": {{yourAbstractInput.value}},
"content": {
"date": "{{year}}-{{month}}",
"location": {{yourLocationInput.value}},
"picture": {{yourPictureInput.value}},
"slug": {{yourSlugInput.value}},
"title": {{yourTitleInput.value}}
}
}

Just bind those to your form and test it out. I haven’t used firebase in retool yet so hopefully this helps. Here is a doc page I found so maybe this could help?
Firebase Query Tutorial

1 Like

Hey @ScottRichards! Welcome back to the community. :slightly_smiling_face:

I think there are a couple of things to consider here. First - for an update action, in particular - it looks like the "Database ref" input probably expects something of the form databaseName/objectKey. In your case, that would be something like blogs/2023-08.

The second important thing is correctly building and formatting the new object, which @TRF's post addresses well!

I hope that helps - let me know if you have any additional questions. :+1:

2 Likes