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

200
Views
Set custom ID in collection - AngularFire 7 and Firebase

How can i set a custom ID to a doc in the new Angularfire 7?

i DONT want the auto genereted one..

my code: (this creates a automatic ID, a want to put my own ID)

  addInfos(infos: any) {
    const notesRef = collection(this.firestore, "infos");
    return addDoc(notesRef, infos)
  }

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

0

You can specify your own document ID and then call setDoc instead of addDoc.

addInfos(infos: any) {
  const notesRef = collection(this.firestore, "infos");
  return setDoc(doc(notesRef, "your-id"), infos)
}

This is pretty much a direct copy from the Firebase documentation on setting a document, so I recommend spending some time in there to get up to speed.

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!