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

97
Views
Firestore query from collection if value exist in mapped array in expo

Im trying to get data from a collection where the information inside it is: owner_uid

members collection

and query my user collection if it exist there , if so to map it in array

users info  collection

is there a way to query this?

also tried to map the the "members collection" and then try to query comparing to the array with no success , is it possible? the code i tried:

 const { chh } = props.route?.params; //current house hold
  const [members, setMembers] = useState([]);
  const [chhUsers, setChhUsers] = useState([]);

  useEffect(() => {
    const q = query(collection(db, `households/${chh.title}/members/`));
    const querySnapshot = getDocs(q).then((querySnapshot) => {
      setChhUsers(querySnapshot.docs.map((doc) => doc.data()));
    });
    console.log(chhUsers);
  }, []);

  useEffect(() => {
    setTimeout(() => {
      const userdb = collection(db, `users`);
      const q = query(userdb, where("owner_uid", "==", chhUsers));
      const querySnapshot = getDocs(q).then((querySnapshot) => {
        setMembers(querySnapshot.docs.map((doc) => doc.data()));
      });
      console.log(members);
    }, 2000);
  }, []);

what i get from chhUsers:

Array [
  Object {
    "owner_uid": "4g8urzWb6RPP44ak9iPIlZidWDo2",
  },
]

but the query of console.log(members); return empty

if i change the chhUsers in const q = query(userdb, where("owner_uid", "==", chhUsers)); it return me the info

almost 4 years ago · Santiago Trujillo
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!