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

155
Views
getDoc from firestore without searching for specific uid

I'm having an issue getting the collection info. Using this code, I could only get the doc with a specific uid.

const snapShot = doc(db, 'Files', 'someUID');
const getSnapShot = await getDoc(snapShot);

console.log(getSnapShot.data());

I used this code to get all of the collection items but threw an error.

const snapShot = collection(db, 'Files');
const getSnapShot = await getDoc(snapShot);

console.log(getSnapShot.forEach(doc => console.log(doc.data()));


Uncaught (in promise) FirebaseError: Expected type 'wc2', but it was: a custom gc2 object

Q: How do I make it work?

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

0

To get all documents from a collection or documents that match a query you should use getDocs() instead of getDoc() that is used to fetch a single document as the function name suggests.

const snapShot = collection(db, 'Files');
const getSnapShot = await getDocs(snapShot);

console.log(getSnapShot.forEach(doc => console.log(doc.data()));
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!