StructuredQuery(mapping=None, *, ignore_unknown_fields=False, **kwargs)
A Firestore query. .. attribute:: select
The projection to return.
:type: google.cloud.firestore_v1.types.StructuredQuery.Projection
Attributes | |
---|---|
Name | Description |
from_ |
Sequence[google.cloud.firestore_v1.types.StructuredQuery.CollectionSelector]
The collections to query. |
where |
google.cloud.firestore_v1.types.StructuredQuery.Filter
The filter to apply. |
order_by |
Sequence[google.cloud.firestore_v1.types.StructuredQuery.Order]
The order to apply to the query results. Firestore guarantees a stable ordering through the following rules: - Any field required to appear in order_by , that is not
already specified in order_by , is appended to the
order in field name order by default.
- If an order on __name__ is not specified, it is
appended by default.
Fields are appended with the same sort direction as the last
order specified, or 'ASCENDING' if no order was specified.
For example:
- SELECT * FROM Foo ORDER BY A becomes
SELECT * FROM Foo ORDER BY A, __name__
- SELECT * FROM Foo ORDER BY A DESC becomes
SELECT * FROM Foo ORDER BY A DESC, __name__ DESC
- SELECT * FROM Foo WHERE A > 1 becomes
SELECT * FROM Foo WHERE A > 1 ORDER BY A, __name__
|
start_at |
google.cloud.firestore_v1.types.Cursor
A starting point for the query results. |
end_at |
google.cloud.firestore_v1.types.Cursor
A end point for the query results. |
offset |
int
The number of results to skip. Applies before limit, but after all other constraints. Must be >= 0 if specified. |
limit |
google.protobuf.wrappers_pb2.Int32Value
The maximum number of results to return. Applies after all other constraints. Must be >= 0 if specified. |
Classes
CollectionSelector
CollectionSelector(mapping=None, *, ignore_unknown_fields=False, **kwargs)
A selection of a collection, such as messages as m1
.
.. attribute:: collection_id
The collection ID. When set, selects only collections with this ID.
:type: str
CompositeFilter
CompositeFilter(mapping=None, *, ignore_unknown_fields=False, **kwargs)
A filter that merges multiple other filters using the given operator.
Direction
Direction(value)
A sort direction.
FieldFilter
FieldFilter(mapping=None, *, ignore_unknown_fields=False, **kwargs)
A filter on a specific field. .. attribute:: field
The field to filter by.
:type: google.cloud.firestore_v1.types.StructuredQuery.FieldReference
FieldReference
FieldReference(mapping=None, *, ignore_unknown_fields=False, **kwargs)
A reference to a field, such as max(messages.time) as max_time
.
.. attribute:: field_path
:type: str
Filter
Filter(mapping=None, *, ignore_unknown_fields=False, **kwargs)
A filter. .. attribute:: composite_filter
A composite filter.
:type: google.cloud.firestore_v1.types.StructuredQuery.CompositeFilter
Order
Order(mapping=None, *, ignore_unknown_fields=False, **kwargs)
An order on a field. .. attribute:: field
The field to order by.
:type: google.cloud.firestore_v1.types.StructuredQuery.FieldReference
Projection
Projection(mapping=None, *, ignore_unknown_fields=False, **kwargs)
The projection of document's fields to return. .. attribute:: fields
The fields to return.
If empty, all fields are returned. To only return the name
of the document, use ['__name__']
.
:type: Sequence[google.cloud.firestore_v1.types.StructuredQuery.FieldReference]
UnaryFilter
UnaryFilter(mapping=None, *, ignore_unknown_fields=False, **kwargs)
A filter with a single operand. .. attribute:: op
The unary operator to apply.
:type: google.cloud.firestore_v1.types.StructuredQuery.UnaryFilter.Operator