title: How to insert array from another query as parameter in DB call FIREBASE
body: <p>I'm trying to build compound query in Expo react native - firestore.
  I have 2 collections in firebase. First &quot;node&quot; is userID and second are IDs of places that had been discovered by this user. Then, I need to take this array of place IDs and pass it as parameter in 2nd query where I got name of each place stored in collection named &quot;databaseOfPlaces&quot;. (I want to make scrollable view with names, so maybe I should add listener later on?)</p>
  <p>My solution is not working very well. Can you help me? Is this the right way, or is there another way how to save DB call?</p>
  <p>Thank you very much.</p>
  <p>This is my code:</p>
  <pre><code>async componentDidMount() {
      db.collection(&quot;placesExploredByUsers&quot;) // default 
        .doc(&quot;mUJYkbcbK6OPrlNuEPzK&quot;)         // default
        .collection(auth.currentUser.uid)
        .get()
        .then((snapshot) =&gt; {
          if (snapshot.empty) {
            alert(&quot;No matching documents.&quot;);
            return;
          }
          const users = [];
          snapshot.forEach((doc) =&gt; {
            const data = doc.data();
            users.push(data);
          });
          this.setState({ users: users });
        })
        .catch((error) =&gt; alert(error));
  
        db.collection(&quot;databaseOfPlaces&quot;)
        .where('placeID','in',this.state.users)
        .get()
        .then((snapshot) =&gt; {
          if (snapshot.empty) {
            alert(&quot;No matching documents.&quot;);
            return;
          }
          const places = [];
          snapshot.forEach((doc) =&gt; {
            const data = doc.data();
            places.push(data);
          });
          this.setState({ places: places });
        })
        .catch((error) =&gt; alert(error));
    }
  </code></pre>