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

239
Views
Why Is Firebase modular version 9 not generating unique id for its documents in Real time Database as Firestore does?

I am working on firebase real-time database v9 but when I send data to the database the generated unique id for each document is not generated as it was in version 8 instead it maps the data in the name of collection hence I cant push another data. I have provided an image to show what is happening enter image description here

    function writeUserData(e) {
    e.preventDefault();
    

    set(ref(realtime, "customers/"), {Name:cname,Contact: 
                contact,
                   Serial:serial,  Device: device, Served: 
               served, AmountC:amountc, 
                AmountP:amountp, Status:status }).then(() => {

                   toast.success("Data Saved Succefully");
      })
      .catch((err) => {
             setError(err.message);
      });
      
  }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The set() method does not generate a random ID. It just adds the data at the path specified. You must use push() to generate a random ID:

push(ref(realtime, "customers/"), {...data}).then(() => {
  console.log("Data added")
})
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!