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

380
Views
How to write items with a particular key value from Firebase Realtime database

Some please consider a solution for me, This is my database: enter image description here

This is my database rules:enter image description here

Am trying to get how many users "referralcode" match any users "refercode", For example, this first user "refercode:" is "Fhb0VP7xje97" I want to know how many users from the whole database has this referral code in their "referralcode" value, and save the number to the "referno" value, so that the number of people referred by users would be visible to the user, so far I have tried this

Var referralcode=snapshot.val().referralcode;
Var refercode=snapshot.val().refercode;
const ref = firebase.database().ref('users');
const query = ref.orderByChild('referralcode').equalTo('refercode').get().then((results) => {
  console.log(Object.keys(results.val()).length);
  results.forEach((snapshot) => {
    console.log(snapshot.key, snapshot.val());
  });
});

But am getting this error: enter image description here

Please can someone tell me what to do specifically?

about 4 years ago · Juan Pablo Isaza
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!