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

132
Vistas
React Native Firestore document deletion

I'm trying to run the code below, but it doesn't work. Can you help me?

await followRequestsColl.doc()
        .where('Followed', '==', user.uid)
        .where('Following', '==', targetUserUid)
        .delete().then(() => {
          console.log('User deleted!');
        });

Error : Possible Unhandled Promise Rejection (id: 6): TypeError: followRequestsColl.doc().where is not a function. (In 'followRequestsColl.doc().where('Followed', '==', user.uid)', 'followRequestsColl.doc().where' is undefined)

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

0

You should only search in collections:

await followRequestsColl.collection('somecollectionname')
    .where('Followed', '==', user.uid)
    .where('Following', '==', targetUserUid)
    .delete().then(() => {
      console.log('User deleted!');
    });
about 4 years ago · Juan Pablo Isaza Denunciar

0

In addition to RobrechtVMs observation that you can't query a document. you also can't call delete() on a query.

You will have to:

  1. Execute the query
  2. Loop over the results
  3. Delete each document in turn

Something like:

const query = followRequestsColl.collection('somecollectionname')
  .where('Followed', '==', user.uid)
  .where('Following', '==', targetUserUid);
query.get().then((snapshot) => {
  snapshot.docs.forEach((doc) => {
    doc.ref.delete();
  })
})

Also see: How to delete document from firestore using where clause

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