title: Firestore Queries Swift 4 for range
body: <p>i want to ask a question related to firestore queries swift. I have firestore structure as below:</p>
  
  <p><a href="https://i.stack.imgur.com/B5RNF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/B5RNF.png" alt="enter image description here"></a></p>
  
  <p>currently i develop a search system, where user can filter <code>min</code> and <code>max</code> persons per <code>team</code>. below are the queries for <code>.collection("team")</code></p>
  
  <pre><code>Firestore.firestore().collection("team")
  .whereField("min", isGreaterThanOrEqualTo : filterMin)
  .whereField("max", isLessThanOrEqualTo : filterMax)
  </code></pre>
  
  <p>Expected: if user place <code>filterMin</code> = 0 and <code>filterMax</code> = 600 data for <code>team1</code> and <code>team2</code> will displayed, if user place <code>filterMin</code> = 3 and <code>filterMax</code> = 500, only data for <code>team2</code> will displayed.</p>
  
  <p>But the problem is if i using the code above, i got an error as below</p>
  
  <blockquote>
    <p>'Invalid Query. All where filters with an inequality (lessThan,
    lessThanOrEqual, greaterThan, or greaterThanOrEqual) must be on the
    same field. But you have inequality filters on 'min' and 'max''</p>
  </blockquote>
  
  <p>I have already read the documentation, but it seems does not help me much. I am still new in swift development and firebase. thanks for helping me.</p>