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

379
Views
FirebaseError: Expected type 'Tc', but it was: a custom Ac object

I'm trying to access all documents from my firestore collection


  const app = initializeApp(firebaseConfig);
  const db = getFirestore(app);


  async function getTodos() {
        try {
            const todoRef = collection(db, 'todos');
            let allTodos = await getDoc(todoRef);
            console.log(allTodos)

        } catch (err) {
            console.log(err)
        }
    }

but it's throwing this err FirebaseError: Expected type 'Tc', but it was: a custom Ac object

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

0

The getDoc() method is used to get a single document and takes a DocumentReference as a parameter. Here todoRef is a CollectionReference and to fetch multiple documents you must use getDocs() instead:

const todoRef = collection(db, 'todos');
let allTodos = await getDocs(todoRef);
about 4 years ago · Juan Pablo Isaza Report

0

You have used getDoc() method which helps to get one single document so just replace your getDoc() with getDocs()

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!