Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

248
Views
How to update value directly in firebase realtime database inside dynamic key

I'm trying to set "pretend" value using the following code but it didn't work.

dataBase.ref().orderByChild('en_word').equalTo('pretend').set({
  en_word: 'Pretend'
})

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Writing a value to the Firebase requires that you know the complete, exact path where you want to write. It doesn't support so-called update queries, where you send a query and a write operation to the database in one go. Instead you will have to:

  1. Execute the query.
  2. Loop over the results.
  3. Update each of them in turn.

So in your case that'd be something like:

let query = dataBase.ref().orderByChild('en_word').equalTo('pretend');
query.once("value").then((results) => {
  results.forEach((snapshot) => {
    snapshot.ref.update({
      en_word: 'Pretend'
    })
  })
})
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!