title: Firebase subcollection
body: <p><a href="https://i.stack.imgur.com/RIari.png" rel="nofollow noreferrer">Firebase Screenshot</a></p>
  <p>I'm trying to make a books app that I can update and add new books through firebase. I've books collection (to show books cover on the home screen) and pages as subcollection( will show pages when I select a book). the listener for the books collection work perfectly books covers appear on the home screen but the listener for subcollection doesn't when I select a book the images doesn't appear. here is the listener for the books collection</p>
  <pre><code>  listener = Firestore.firestore().collection(DatabaseService.booksCollectionCollection).addSnapshotListener({ [weak self] (snapshot, error) in
              
              
              if let error = error {
                  DispatchQueue.main.async {
                      self?.showAlert(title: &quot;Try again&quot;, message: &quot;\(error.localizedDescription)&quot;)
                  }
              } else if
                  let snapshot = snapshot {
                  
                  let bookSnap = snapshot.documents.map { books($0.data())}
                
                  self?.booksCollection1 = bookSnap
              }
          })
  </code></pre>
  <p>the listener for subcollection (pagesCollection)</p>
  <pre><code> listener = Firestore.firestore().collection(DatabaseService.booksCollectionCollection)
             .document(bookS.bookId)
             .collection(DatabaseService.pagesCollection)
             .addSnapshotListener({ [weak self] (snapshot, error) in
             if let error = error {
               DispatchQueue.main.async {
                 self?.showAlert(title: &quot;Try Again&quot;, message: error.localizedDescription)
               }
             } else if let snapshot = snapshot {
               let pages = snapshot.documents.map { books($0.data()) }
               self?.collectionPages = pages
             }
           })
           }
  
  </code></pre>
  <p>please help me to figure out where is the problem I've been searching for a solution for days</p>