title: Firebase modular trying to use query in nested collections
body: <p>I'm trying to get data from a nested collection. When I create an appointment - I'm saving the appointmentId and doctorId in the current user. When I need them I take them from the user. And there is the big question - I creating appointments in firestore like this - appointments - [doctorId] (1) - currentDoctorApp - appointmentId - data
  <a href="https://i.stack.imgur.com/dvTuc.jpg" rel="nofollow noreferrer">part1</a> |
  <a href="https://i.stack.imgur.com/L0T37.png" rel="nofollow noreferrer">part2</a>.
  I know I can add data like normal - appointments - autoId - data, but I want to separate them, for a better search I think?</p>
  <p>(1) - because I think if I have 50 doctors and the current user has appointmenthours at only 2, I will search in these 2 fields, not in all 50</p>
  <p>This is the way I add it to appointments collection, but how can I get it? Еspecially when I get more than 1 doctorId. First I have to query by document id. I hope it's not very confusing</p>
  <pre><code>try {
          await setDoc(doc(db, `appointments/${params.doctorId}`, 'currentDoctorApp', generatedId), {
              doctorId: params.doctorId,
              userId: currentUser.uid,
              date: date,
              hour: hour,
              status: 'active',
              address: doctorData.hospitalAddres,
              hospital: doctorData.hospitalName
          });
  
          await updateDoc(doc(db, 'users', currentUser.uid), {
              appointments: arrayUnion({
                  appointmentId: generatedId,
                  doctorId: params.doctorId,
              })
          });
      } catch (error) {
          console.log(error);
      }
  </code></pre>