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

123
Vistas
Firestore - how do i access .doc() random generated document ID?

trying to figure out this. Im using firestore and trying to store my random generated numbers/characters when im using .doc() while creating up documents instead of naming them.

Now my problem is i wanna make another collection inside that document. A subcollection that is. How do i go about this? Its super easy when i have a hardcoded variable because then i know directly what document to create it in. But how do i work around it with random generated chars/numbers?

Heres my entire thing

        company_id: CompanyID,
        })```

firestore.collection('books').doc().set({
        company_id: CompanyID,
        })        
        .then(() => {
            firestore.collection('books').doc().collection('messages').add({
            text: 'hej',
            createdAt: firebase.firestore.FieldValue.serverTimestamp(),
            myIdNumber,
            displayName,
            })
        })
        .catch((error: string) => {
            console.error("Error while creating: ", error);
        });```
about 4 years ago · Juan Pablo Isaza
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