Query a Firestore collection with a cursor end at filter

Query a Firestore collection with a cursor end at filter

Documentation pages that include this code sample

To view the code sample used in context, see the following documentation:

Code sample

Go

query := client.Collection("cities").OrderBy("population", firestore.Asc).EndAt(1000000)

Java

Query query = cities.orderBy("population").endAt(4921000L);

Node.js

const endAtRes = await db.collection('cities')
  .orderBy('population')
  .endAt(1000000)
  .get();

PHP

$query = $citiesRef
    ->orderBy('population')
    ->endAt([1000000]);

Python

cities_ref = db.collection(u'cities')
query_end_at = cities_ref.order_by(u'population').end_at({
    u'population': 1000000
})

Ruby

query = cities_ref.order("population").end_at(1_000_000)

What's next

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