The startAt()
method includes the starting point, while endAt()
is used to set an end point for your query in order to refine the results.
Here's a snippet of code using startAt()
(Web v9):
import { query, orderBy, startAt } from "firebase/firestore";
const q = query(citiesRef, orderBy("population"), startAt(1000000));
And here's an example utilizing endAt()
(Web v9):
import { query, orderBy, endAt } from "firebase/firestore";
const q = query(citiesRef, orderBy("population"), endAt(1000000));
To learn more about paginating data with query cursors, you can refer to this documentation.
Additionally, as mentioned by @Nicholas Tower, be sure to explore other tabs for further examples in various languages and versions such as Web v8, Swift, Objective-C, Java, etc.