title: How to check if through multiple collections to see if a document exists
body: <p>I'm trying to create an if/else or a switch case statement that would check through each collection for the existing post id Ex:</p>
  <ul>
  <li>posts/userPosts/PostId,</li>
  <li>posts/sportsPosts/PostId,</li>
  <li>posts/travelPosts/PostId,</li>
  <li>etc</li>
  </ul>
  <p>After the postId is found, I would have some new data added to the appropriate collection. Right now, it's not updating any data in any of the collections. So I'm really having trouble trying to find a good way to implement this. Can anyone suggest the best way to implement this?</p>
  <p>As of right now, this is what I have (I know it's terribly written, and it also doesn't work)</p>
  <pre><code>bool isNotTimelinePost = postsReference
              .document(postOwnerId)
              .collection(&quot;usersPosts&quot;)
              .document(postId) ==
          null;
  
      bool isNotSuggPost = postsReference
              .document(postOwnerId)
              .collection(&quot;suggestionPosts&quot;)
              .document(postId) ==
          null;
  
      bool isNotPhotographyPost = postsReference
              .document(postOwnerId)
              .collection(&quot;photographyPosts&quot;)
              .document(postId) ==
          null;
  
      bool isNotSportsPost = postsReference
              .document(postOwnerId)
              .collection(&quot;sportsPosts&quot;)
              .document(postId) ==
          null;
  
      if (isNotTimelinePost == false) {
        postsReference
            .document(postOwnerId)
            .collection(&quot;usersPosts&quot;)
            .document(postId)
            .updateData({'commentCount': FieldValue.increment(1)});
      } else if (isNotSuggPost == false) {
        postsReference
            .document(postOwnerId)
            .collection(&quot;suggestionPosts&quot;)
            .document(postId)
            .updateData({'commentCount': FieldValue.increment(1)});
      } else if (isNotPhotographyPost == false) {
        postsReference
            .document(postOwnerId)
            .collection(&quot;photographyPosts&quot;)
            .document(postId)
            .updateData({'commentCount': FieldValue.increment(1)});
      } else if (isNotSportsPost == false) {
        postsReference
            .document(postOwnerId)
            .collection(&quot;sportsPosts&quot;)
            .document(postId)
            .updateData({'commentCount': FieldValue.increment(1)});
      }
  </code></pre>