An example of an invalid order and limit Firestore query

An example of an invalid order and limit Firestore query

Code sample

Go

// Note: This is an invalid query. It violates the constraint that range
// and order by are required to be on the same field.
query := cities.Where("population", ">", 2500000).OrderBy("country", firestore.Asc)

Java

Query query = cities.whereGreaterThan("population", 2500000L).orderBy("country");

Node.js

citiesRef.where('population', '>', 2500000).orderBy('country');

Python

cities_ref = db.collection(u'cities')
query = cities_ref.where(u'population', u'>', 2500000).order_by(u'country')
results = query.stream()