title: iOS - Firestore multiple orderBy and where clauses on indexes within a composite index
body: <p>I'm trying to do three things using Firestore:</p>
  
  <ul>
  <li>fetch documents whose "contentType" field is "basic",</li>
  <li>fetch documents that are created past a certain point in time. (5AM in the example.)</li>
  <li>order documents according to the "like" count.</li>
  </ul>
  
  <p>The documents in the <code>contents</code> collection look like this (leaving out unnecessary details):</p>
  
  <pre class="lang-js prettyprint-override"><code>{
    date: Timestamp;
    contentType: string;
    response: {
      like: Number;
    };
  }
  </code></pre>
  
  <p>And here is the iOS code:</p>
  
  <pre><code>let dateKey = "date"
  let likeKey = "response.like"
  let startDate = Date().setLocalHour(5)
  let timestamp = Timestamp(date: startDate)
  
  Firestore.firestore()
      .collection(path: .contents)
      .whereField(.contentType, isEqualTo: "basic")
      .whereField(dateKey, isGreaterThanOrEqualTo: timestamp)
      .order(by: dateKey, descending: true)
      .order(by: likeKey, descending: true)
      .limit(to: Constant.fetchLimit)
  </code></pre>
  
  <p>The <code>order(by: dateKey)</code> part is only necessary because Firebase demands it. Otherwise, an exception will be thrown, complaining that the where clause and the orderby clauses don't match.</p>
  
  <p>I already created a composite index that says <code>contents
  contentType Ascending date Descending response.like Descending</code>. </p>
  
  <p><strong>Expectation &amp; Results</strong></p>
  
  <p>I'm expecting the documents to be ordered by the <code>like</code> count, and all documents to be "basic" type and created past 5 a.m. of today. </p>
  
  <p>Instead, only the first two conditions are applied, and the third is completely ignored. Different mixes of two conditions work. It's the three conditions combined that is not working.</p>
  
  <p>So my questions is, since Firebase documents don't say anything about having more than two multiple orderby &amp; where combinations, is this a bug or something that's just not possible?</p>