An example Firestore query with an invalid range

An example Firestore query with an invalid range

Explore further

For detailed documentation that includes this code sample, see the following:

Code sample

Go

query := cities.Where("state", ">=", "CA").Where("population", ">", 1000000)

Java

Query invalidRangeQuery =
    cities.whereGreaterThanOrEqualTo("state", "CA").whereGreaterThan("population", 100000);

Node.js

citiesRef.where('state', '>=', 'CA').where('population', '>', 1000000);

PHP

$invalidRangeQuery = $citiesRef
    ->where('state', '>=', 'CA')
    ->where('population', '>', 1000000);

Python

cities_ref = db.collection(u'cities')
cities_ref.where(
    u'state', u'>=', u'CA').where(u'population', u'>=', 1000000)

Ruby

invalid_range_query = cities_ref.where("state", ">=", "CA").where("population", ">", 1_000_000)

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.