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

224
Views
Uncaught (in promise) FirebaseError: Expected type 'rc', but it was: a custom ac object

The error happens in this code:

document.querySelector('.adding').onclick = async function adding() {

  const output = document.querySelector('.added')
  const translate = collection(db, "translate")
  await setDoc(translate, {
    eng_tot,
    sank_tot
  });
  output.innerText = 'Added'
  console.log('added', english, sanskrit)
  english.value = ''
  sanskrit.value = ''
  eng_tot = []
  sank_tot = []
  setTimeout(() => {
    output.innerText = ''
  }, 2000);
};

** I am trying from 2 days but can't understand what's the problem !!**

I am trying to add an array in firebase , i am tring so many solution but can't get what's the problem !!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The setDoc() function takes a DocumentReference as first parameter but you are passing a CollectionReference. If you want to add a document with random ID then use addDoc() instead:

import { collection, addDoc } from "firebase/firestore"

const translate = collection(db, "translate")
await addDoc(translate, {
  eng_tot,
  sank_tot
});

If you want to specify the document ID yourself, then use doc() to create a document reference and then use setDoc():

import { doc, setDoc } from "firebase/firestore"

const translateDoc = doc(db, "translate", "custom_doc_id")
await setDoc(translateDoc, {
  eng_tot,
  sank_tot
});
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!