Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

347
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda