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

96
Vistas
Subcollection in Firestore

I can't create a document in a non existing subcollection.

I have a collection users, with a document that has the userId as Id. In this document I want a subcollection orders

the orders subcollection is not created yet. But you cant create empty subcollections.

So I do this:

const OrderID = 1; //just for testing
const ref = doc(
        db,
        "users",
        getAuth().currentUser.uid,
        "orders",
        OrderID
      );

But that does not work.

How can I do this?

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

0

Ok found it OrderID can't be a number. It must be a string. The error I got did not tell me that. It complained about an out of range function.....

const OrderID = 1; //just for testing
const ref = doc(
        db,
        "users",
        getAuth().currentUser.uid,
        "orders",
        OrderID.toString()
      );
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