irebase  ](/docs/gemini-in-firebase)

  * [ Emulator Suite  ](/docs/emulator-suite)
  * [ Authentication  ](/docs/auth)
  * [ Realtime Database  ](/docs/database)
  * [ Firestore  ](/docs/firestore)
  * [ Storage  ](/docs/storage)
  * [ ML  ](/docs/ml)
  * [ Hosting  ](/docs/hosting)
  * [ Cloud Functions  ](/docs/functions)
  * [ Security Rules  ](/docs/rules)
  * [ App Check  ](/docs/app-check)
  * [ Extensions  ](/docs/extensions)

  * [ Crashlytics  ](/docs/crashlytics)
  * [ Performance Monitoring  ](/docs/perf-mon)
  * [ Test Lab  ](/docs/test-lab)
  * [ App Distribution  ](/docs/app-distribution)

  * [ Analytics  ](/docs/analytics)
  * [ Remote Config  ](/docs/remote-config)
  * [ A/B Testing  ](/docs/ab-testing)
  * [ Cloud Messaging  ](/docs/cloud-messaging)
  * [ In-App Messaging  ](/docs/in-app-messaging)
  * [ Dynamic Links  ](/docs/dynamic-links)
  * [ Google AdMob  ](/docs/admob)
  * [ Google Ads  ](/docs/ads)
  * [ App Indexing  ](/docs/app-indexing)

Firebase is back at Google I/O on May 14! [ Register now.
](https://io.google/2024/?utm_source=firebase&utm_medium=embedded_marketing&utm_campaign=&utm_content=)

  * [ Firebase ](https://firebase.google.com/)
  * [ Documentation ](https://firebase.google.com/docs)
  * [ Firestore ](https://firebase.google.com/docs/firestore)
  * [ Build ](https://firebase.google.com/docs/build)

Send feedback

#  Query with range and inequality filters on multiple fields overview

Stay organized with collections  Save and categorize content based on your
preferences.

**Note:** This feature is a public preview. This means that the functionality
might change in backward-incompatible ways. A preview release is not subject
to any SLA or deprecation policy and may receive limited or no support.

Cloud Firestore supports using range and inequality filters on multiple fields
in a single query. You can now have range and inequality conditions on
multiple fields and simplify your application development by delegating
implementation of post-filtering logic to Cloud Firestore.

##  Range and inequality filters on multiple fields

The following query returns all users whose age is greater than 35 and height
is between 60 and 70 using range filters on age and height.

###  Web version 9 modular

    
    
      const q = query(
          collection(db, "users"),
          where('age', '>', 35),
          where('height', '>', 60),
          where('height', '<', 70)
        );
    

###  Swift

    
    
     let query = db.collection("users")
       .whereField("age", isGreaterThan: 35)
       .whereField("height", isGreaterThan: 60)
       .whereField("height", isLessThan: 70)
    

###  Objective-C

    
    
     FIRQuery *query = 
      [[[[self.db collectionWithPath:@"users"]
     queryWhereField:@"age" isGreaterThan:@35]
        queryWhereField:@"height" isGreaterThan:@60] 
            queryWhereField:@"height" isLessThan:@70];
    

###  Java Android

    
    
     Query query = db.collection("users")
      .whereGreaterThan("age", 35)
      .whereGreaterThan("height", 60)
      .whereLessThan("height", 70);
    

###  Kotlin+KTX Android

    
    
     val query = db.collection("users")
      .whereGreaterThan("age", 35)
      .whereGreaterThan("height", 60)
      .whereLessThan("height", 70)
    

###  Java

    
    
      db.collection("users")
        .whereGreaterThan("age", 35)
        .whereGreaterThan("height", 60)
        .whereLessThan("height", 70);
    

###  Node.js

    
    
    db.collection("users")
      .where('age', '>', 35),
      .where('height', '>', 60),
      .where('height', '<', 70)
    

##  Indexing considerations

Before you start running your queries, make sure you have read about [ queries
](/docs/firestore/query-data/get-data) and the Cloud Firestore [ data model
](/docs/firestore/query-data/data-model) .

In Cloud Firestore, the ` ORDER BY ` clause of a query determines which
indexes can be used to serve the query. For example, an ` ORDER BY a ASC, b