Query a Firestore collection with a cursor start at field filter

Query a Firestore collection with a cursor start at field 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).StartAt(1000000)

Java

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

Node.js

const startAtRes = await db.collection('cities')
  .orderBy('population')
  .startAt(1000000)
  .get();

PHP

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

Python

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

Ruby

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

What's next

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