Truy cập vào bảng điều khiển

Query

public class Query extends Object
Known Direct Subclasses

A Query which you can read or listen to. You can also construct refined Query objects by adding filters and ordering.

Subclassing Note: Firestore classes are not meant to be subclassed except for use in test mocks. Subclassing is not supported in production code and new SDK releases may break code that does so.

Nested Class Summary

enum Query.Direction An enum for the direction of a sort. 

Public Method Summary

ListenerRegistration
addSnapshotListener(Activity activity, EventListener<QuerySnapshot> listener)
Starts listening to this query using an Activity-scoped listener.
ListenerRegistration
addSnapshotListener(MetadataChanges metadataChanges, EventListener<QuerySnapshot> listener)
Starts listening to this query with the given options.
ListenerRegistration
addSnapshotListener(Executor executor, EventListener<QuerySnapshot> listener)
Starts listening to this query.
ListenerRegistration
addSnapshotListener(Executor executor, MetadataChanges metadataChanges, EventListener<QuerySnapshot> listener)
Starts listening to this query with the given options.
ListenerRegistration
addSnapshotListener(Activity activity, MetadataChanges metadataChanges, EventListener<QuerySnapshot> listener)
Starts listening to this query with the given options, using an Activity-scoped listener.
ListenerRegistration
addSnapshotListener(EventListener<QuerySnapshot> listener)
Starts listening to this query.
Query
endAt(DocumentSnapshot snapshot)
Creates and returns a new Query that ends at the provided document (inclusive).
Query
endAt(Object... fieldValues)
Creates and returns a new Query that ends at the provided fields relative to the order of the query.
Query
endBefore(DocumentSnapshot snapshot)
Creates and returns a new Query that ends before the provided document (exclusive).
Query
endBefore(Object... fieldValues)
Creates and returns a new Query that ends before the provided fields relative to the order of the query.
boolean
Task<QuerySnapshot>
get()
Executes the query and returns the results as a QuerySnapshot.
Task<QuerySnapshot>
get(Source source)
Executes the query and returns the results as a QuerySnapshot.
FirebaseFirestore
getFirestore()
Gets the Firestore instance associated with this query.
int
Query
limit(long limit)
Creates and returns a new Query that's additionally limited to only return up to the specified number of documents.
Query
orderBy(String field, Query.Direction direction)
Creates and returns a new Query that's additionally sorted by the specified field, optionally in descending order instead of ascending.
Query
orderBy(FieldPath fieldPath)
Creates and returns a new Query that's additionally sorted by the specified field.
Query
orderBy(FieldPath fieldPath, Query.Direction direction)
Creates and returns a new Query that's additionally sorted by the specified field, optionally in descending order instead of ascending.
Query
orderBy(String field)
Creates and returns a new Query that's additionally sorted by the specified field.
Query
startAfter(Object... fieldValues)
Creates and returns a new Query that starts after the provided fields relative to the order of the query.
Query
startAfter(DocumentSnapshot snapshot)
Creates and returns a new Query that starts after the provided document (exclusive).
Query
startAt(Object... fieldValues)
Creates and returns a new Query that starts at the provided fields relative to the order of the query.
Query
startAt(DocumentSnapshot snapshot)
Creates and returns a new Query that starts at the provided document (inclusive).
Query
whereArrayContains(FieldPath fieldPath, Object value)
Creates and returns a new Query with the additional filter that documents must contain the specified field, the value must be an array, and that the array must contain the provided value.
Query
whereArrayContains(String field, Object value)
Creates and returns a new Query with the additional filter that documents must contain the specified field, the value must be an array, and that the array must contain the provided value.
Query
whereEqualTo(String field, Object value)
Creates and returns a new Query with the additional filter that documents must contain the specified field and the value should be equal to the specified value.
Query
whereEqualTo(FieldPath fieldPath, Object value)
Creates and returns a new Query with the additional filter that documents must contain the specified field and the value should be equal to the specified value.
Query
whereGreaterThan(FieldPath fieldPath, Object value)
Creates and returns a new Query with the additional filter that documents must contain the specified field and the value should be greater than the specified value.
Query
whereGreaterThan(String field, Object value)
Creates and returns a new Query with the additional filter that documents must contain the specified field and the value should be greater than the specified value.