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

335
Vistas
Can you orderBy two fields in firebase?

I'm using google Firestore as my database, I wanted to order my material table by two fields (name and date) so I can have it in alphabetical order + in the date it was created, however I got the following error:

enter image description here

This is my code with "acudiente" being the name of the user and "fecha" being the date of the order and "pedidos" being the collection.

useEffect(() => { 
    const usuariosRef = db.collectionGroup('pedidos')
    usuariosRef.orderBy("acudiente", "fecha").onSnapshot(snapshot => {
      const tempData = [];
      snapshot.forEach((doc) => {
        const data = doc.data();
        
        tempData.push(data);
        console.log(tempData)
      });
      setPedidos(tempData);
    })
   }, []);
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