Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

343
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!