endBeforeDocument method
- DocumentSnapshot<
Object?> documentSnapshot
Ends the query results before the document.
Parameters:
documentSnapshot: The document to end before.
Returns: A new Query ending before the document.
Example:
query = query.endBeforeDocument(snapshot);
Implementation
Query<T> endBeforeDocument(DocumentSnapshot documentSnapshot) {
Query<T> newQuery = Query<T>(
helper: QueryHelper(),
oracledb: _oracledb,
path: path,
);
_helper.dupQuery(newQuery, this);
String fieldName = newQuery._explicitOrder[0]["field"];
final dynamic data = documentSnapshot.data() ?? {};
final value = data[fieldName];
newQuery._conditions.add({"field": fieldName, "op": "<", "value": value});
return newQuery;
}