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

108
Views
How to combine different paths in firestore version 9

I was using firestore version 8 and used the following code to create alternations in code:

const subQuestionRef = DB.collection('groups')
                         .doc(groupId)
                         .collection('questions')
                         .doc(questionId)
                         .collection('subQuestions')

if(someCondition) {
  subQuestionRef.doc(uid).set({somthing})
} else {
  subQuestionRef.doc(subQuestionId).set({somthingElse})
}

I couldn't find a way to create such alternations in firestore version 9.

Do you know how to create alternations in version 9?

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

0

the way I would approach this with V9 will be the follow:

const subQuestionRef = collection(db, `groups/${groupId}/questions/${questionId}/subQuestions`)

if (someCondition) {
  setDoc( doc(subQuestionRef, uid), {something} )
} else {
  setDoc( doc(subQuestionRef, subQuestionId), {somethingElse} )
}

We now have a really nice API reference in V9.

doc() reference: https://firebase.google.com/docs/reference/js/firestore_.md#doc

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!