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

113
Vistas
How do I make sure null and empty string fields arent added to my documents in firestore Reactjs

I am adding objects to a document and I want to make sure empty strings and null instances don't add fields as I only want to create fields once they have been actually added

 await updateDoc(itemRef,
 {thing: '3232',
    thing2: null,
    thing3:'' });
    }

how do I make sure only thing: 3232 is in the new document and the best way to go about it?

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

0

Probably easiest to just write a function that filters the property keys based on value:

function filterInPlace(obj) {
    for (const [key, value] of Object.entries(obj))
        if (obj[key] == null || obj[key] == '')
            delete obj[key]
}
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