How to change existing Firebase value?

Hello, how do I change an existing value? Example: In the app the user could change the email, but I’m not able to change the value in firebase

Why would you change a user’s email address in Firebase? The user should manage any changes to their email address or password.

It was just an example, not necessarily the email, it could be any other information. I just want to know how to change existing information.

I just want to change an existing value, you know? Example: change January to February:

{
  "usuarios": {
    "Hxgh24uNvjcg628ITy6mzzXl54s1": {
      "Mes": "January"
    }
  }
}
{
  "usuarios": {
    "Hxgh24uNvjcg628ITy6mzzXl54s1": {
      "Mes": "February"
    }
  }
}

All this in firebase, I just want to know how do I change a value.

Set cloud variable usruarios/[app variable userId]/Mes to “February”

I’m assuming that usruarios is the top level of your Firebase database. If not, you need to use the full path to it. I’m also assuming that Hxgh24uNvjcg628ITy6mzzXl54s1 is your userId value from Firebase Sign In. If not, then you would need to replace that in the path I provided above.

Nothing happens

Okay… is it possible your Firebase rules are incorrect? Are you signed in to that userId when you test this?

And what does your Firebase data structure look like? Is there anything above “usuarios”?

Can you get a value from Firebase as a test? If not, your rules are probably preventing that.

These are my rules and there is nothing above usuarios, but I log in on userID

image

JSON:

{
  "usuarios": {
    "ldKhPuC9ccZelOICyIkga5trLrr2": {
      "Ano": "2023",
      "Celular": "312312312312312",
      "Dia": "1",
      "Email": "fulano@gmail.com",
      "Mes": "11",
      "Nome": "Fulano",
      "Porque": "Não gosto",
      "Problema": "Cigarro eletrônico",
      "Sobrenome": "fulano"
    }
  }
}

That should work. Did you create the Firebase database less than 30 days ago? After 30 days, those rules will fail and you will need more secure rules.

Have you double-checked that the green userId block’s value matches what you have in Firebase?

That is, what happens if you assign the cloud variable to a label’s text? Show your blocks for that and explain the result.

I created today

And would it work to delete the user’s account and recreate their account, only with the information changed. I was thinking, maybe right, but I don’t know how to do it.

You can do that. It might be easier to just change the necessary information but sure, you could recreate the entire data structure for usuarios/[userId] each time you need to make a change. But if you can’t make a change at all to your Firebase data, I don’t see how that will help you.