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

118
Views
How do I access another user's data by a specific field?

I'm trying to make a user send their num to another user. I created a random keycode for every user to send each other a num.

I tried accessing the data by querying them.

     const sendNum = async(e) => {
        const userCol = collection(db, "users")  
        e.preventDefault();
        

        const targetQuery = query(userCol, where("keycode", "==", target))
        const targetSnapshot = await getDocs(targetQuery)
        
        targetSnapshot.forEach((doc) => {
            console.log(doc.data().num);
        })
        console.log(targetSnapshot);

But it returns an object rather than the another user's num field

Nu {_firestore: xc, _userDataWriter: ah, _snapshot: Oo, metadata: Su, query: Ic}

Here's what the data looks like:

enter image description here

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

0

Posting the solution suggested by Doug Stevenson as a Community Wiki for visibility.

From the description it's not possible to tell what value the target holds. In this case, hard coding the value worked to access the user field.

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!