A Firestore query.
JSON representation | |
---|---|
{ "select": { object ( |
Fields | |
---|---|
select |
The projection to return. |
from[] |
The collections to query. |
where |
The filter to apply. |
orderBy[] |
The order to apply to the query results. Firestore guarantees a stable ordering through the following rules:
Fields are appended with the same sort direction as the last order specified, or 'ASCENDING' if no order was specified. For example:
|
startAt |
A starting point for the query results. |
endAt |
A end point for the query results. |
offset |
The number of results to skip. Applies before limit, but after all other constraints. Must be >= 0 if specified. |
limit |
The maximum number of results to return. Applies after all other constraints. Must be >= 0 if specified. |
Projection
The projection of document's fields to return.
JSON representation | |
---|---|
{
"fields": [
{
object ( |
Fields | |
---|---|
fields[] |
The fields to return. If empty, all fields are returned. To only return the name of the document, use |
FieldReference
A reference to a field, such as max(messages.time) as max_time
.
JSON representation | |
---|---|
{ "fieldPath": string } |
Fields | |
---|---|
fieldPath |
|
CollectionSelector
A selection of a collection, such as messages as m1
.
JSON representation | |
---|---|
{ "collectionId": string, "allDescendants": boolean } |
Fields | |
---|---|
collectionId |
The collection ID. When set, selects only collections with this ID. |
allDescendants |
When false, selects only collections that are immediate children of the |
Filter
A filter.
JSON representation | |
---|---|
{ // Union field |
Fields | ||
---|---|---|
Union field filter_type . The type of filter. filter_type can be only one of the following: |
||
compositeFilter |
A composite filter. |
|
fieldFilter |
A filter on a document field. |
|
unaryFilter |
A filter that takes exactly one argument. |
CompositeFilter
A filter that merges multiple other filters using the given operator.
JSON representation | |
---|---|
{ "op": enum ( |
Fields | |
---|---|
op |
The operator for combining multiple filters. |
filters[] |
The list of filters to combine. Must contain at least one filter. |
Operator
A composite filter operator.
Enums | |
---|---|
OPERATOR_UNSPECIFIED |
Unspecified. This value must not be used. |
AND |
The results are required to satisfy each of the combined filters. |
FieldFilter
A filter on a specific field.
JSON representation | |
---|---|
{ "field": { object ( |
Fields | |
---|---|
field |
The field to filter by. |
op |
The operator to filter by. |
value |
The value to compare to. |
Operator
A field filter operator.
Enums | |
---|---|
OPERATOR_UNSPECIFIED |
Unspecified. This value must not be used. |
LESS_THAN |
The given Requires:
|
LESS_THAN_OR_EQUAL |
The given Requires:
|
GREATER_THAN |
The given Requires:
|
GREATER_THAN_OR_EQUAL |
The given Requires:
|
EQUAL |
The given field is equal to the given value . |
NOT_EQUAL |
The given Requires:
|
ARRAY_CONTAINS |
The given field is an array that contains the given value . |
IN |
The given Requires:
|
ARRAY_CONTAINS_ANY |
The given Requires:
|
NOT_IN |
The value of the Requires:
|
UnaryFilter
A filter with a single operand.
JSON representation | |
---|---|
{ "op": enum ( |
Fields | |
---|---|
op |
The unary operator to apply. |
field |
The field to which to apply the operator. |
Operator
A unary operator.
Enums | |
---|---|
OPERATOR_UNSPECIFIED |
Unspecified. This value must not be used. |
IS_NAN |
The given field is equal to NaN . |
IS_NULL |
The given field is equal to NULL . |
IS_NOT_NAN |
The given Requires:
|
IS_NOT_NULL |
The given Requires:
|
Order
An order on a field.
JSON representation | |
---|---|
{ "field": { object ( |
Fields | |
---|---|
field |
The field to order by. |
direction |
The direction to order by. Defaults to |
Direction
A sort direction.
Enums | |
---|---|
DIRECTION_UNSPECIFIED |
Unspecified. |
ASCENDING |
Ascending. |
DESCENDING |
Descending. |