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

346
Vistas
FirebaseError: Expected type 'Hc', but it was: a custom Yc object]

i am trying to do a batch entry, but this error keeps occurring. i am passing an array in a .doc, it works fine on other function, where i pass an array into .doc using loops and functions.

please help me out and please explain me what the error means.

export const AddTaskToFriend = (
  ArryOfIds,
  email,
  title,
  tag,
  prayority,
  completed
) => {
  return async (dispatch) => {
    const db = firebase.firestore();
    var batch = db.batch();

    for (let i = 0; i < ArryOfIds.length; i++) {
      const Collections = db
        .collection("Tasks")
        .doc(ArryOfIds[i])
        .collection("SingleTask");
      batch.set(Collections, {
        creater: firebase.auth().currentUser.uid,
        UpdatedOn: new Date().toString(),
        CreatedOn: new Date().toString(),
        email,
        title,
        tag,
        prayority,
        completed,
      });
    }
    batch
      .commit()
      .then((success) => {
        console.log(` its a success ${success}`);
      })
      .catch((error) => {
        console.log(error);
      });
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

It looks like the error could come from batch.set(). As per this documentation .set() needs a reference to a document, and in your case you are passing a collection reference:

const Collections = db
        .collection("Tasks")
        .doc(ArryOfIds[i])
        .collection("SingleTask");

You could try adding .doc() after .collection("SingleTask") to see if this solves the issue.

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