Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

192
Vistas
How can read main document id value of collectiongroup in firestore

My question need to explain here enter image description here

in photo , you will see current user id is ```

oUkU2BHhT3M27ld3AwHPGn6nU9q2 ```

its id is also in swipes collection group. I query current user id from all swipes collection as follow


     const queryid =query(collectionGroup(db, "swipes"),where("id","==",user.uid))
     const myid = await getDocs(queryid)
     .then((snapshot)=>snapshot.docs.map(doc=>doc.id))
     console.log('myid ',myid)
  

But MY problem is I dont know how can get id value if this swipes collection groups I mean I want to know all owner id of swipes collection that contain current user id

Please help me

In this case , I want to read ```

HPYzRaCakGbS0lu9IhMq94dK0rj2 ``` because this id swipes collection contain current user id I want to read all owner id of swipes collection

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

To determine the parent document for a result in a collection group query, you can do:

const querySnapshot = await getDocs(queryid)
querySnapshot.forEach((doc) => {
  const parentCollection = doc.ref.parent
  const parentDocRef = parentCollection.parent
  const parentDocId = parentDocRef.id
  ...
})
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda