younifyd
Menu

Firestore.projects.databases.documents.run Query

Runs a query.

POST/v1/{parent}:runQuery

Use it in a workflow

  1. Add a step and choose the Firestore connector.
  2. Pick the Firestore.projects.databases.documents.run Query action (under projects).
  3. Fill in the fields below, then reference the result from later steps as {{firestoreProjectsDatabasesDocumentsRunQuery.response.data}}.

Request

Path parameters

parentstringrequired

Required. The parent resource name. In the format: `projects/{project_id}/databases/{database_id}/documents` or `projects/{project_id}/databases/{database_id}/documents/{document_path}`. For example: `projects/my-project/databases/my-database/documents` or `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`

Query parameters

$.xgafvstring

V1 error format.

One of12

access_tokenstring

OAuth access token.

altstring

Data format for response.

One ofjsonmediaproto

callbackstring

JSONP

fieldsstring

Selector specifying which fields to include in a partial response.

keystring

API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.

oauth_tokenstring

OAuth 2.0 token for the current user.

prettyPrintboolean

Returns response with indentations and line breaks.

quotaUserstring

Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

upload_protocolstring

Upload protocol for media (e.g. "raw", "multipart").

uploadTypestring

Legacy upload protocol for media (e.g. "media", "multipart").

Request body

Enter the body as JSON in the step's Body field.

newTransactionobject

Options for creating a new transaction.

readOnlyobject1 fields

Options for a transaction that can only be used to read documents.

readWriteobject1 fields

Options for a transaction that can be used to read and write documents.

readTimestring (google-datetime)

Reads documents as they were at the given time. This may not be older than 270 seconds.

structuredQueryobject

A Firestore query.

endAtobject2 fields

A position in a query result set.

fromarray<object>2 fields

The collections to query.

limitinteger (int32)

The maximum number of results to return. Applies after all other constraints. Requires: * The value must be greater than or equal to zero if specified.

offsetinteger (int32)

The number of documents to skip before returning the first result. This applies after the constraints specified by the `WHERE`, `START AT`, & `END AT` but before the `LIMIT` clause. Requires: * The value must be greater than or equal to zero if specified.

orderByarray<object>2 fields

The order to apply to the query results. Firestore allows callers to provide a full ordering, a partial ordering, or no ordering at all. In all cases, Firestore guarantees a stable ordering through the following rules: * The `order_by` is required to reference all fields used with an inequality filter. * All fields that are required to be in the `order_by` but are not already present are appended in lexicographical ordering of the field name. * 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: * `ORDER BY a` becomes `ORDER BY a ASC, __name__ ASC` * `ORDER BY a DESC` becomes `ORDER BY a DESC, __name__ DESC` * `WHERE a > 1` becomes `WHERE a > 1 ORDER BY a ASC, __name__ ASC` * `WHERE __name__ > ... AND a > 1` becomes `WHERE __name__ > ... AND a > 1 ORDER BY a ASC, __name__ ASC`

selectobject1 fields

The projection of document's fields to return.

startAtobject2 fields

A position in a query result set.

whereobject3 fields

A filter.

transactionstring (byte)

Run the query within an already active transaction. The value here is the opaque transaction ID to execute the query in.

json
{
  "newTransaction": {
    "readOnly": {
      "readTime": "string"
    },
    "readWrite": {
      "retryTransaction": "string"
    }
  },
  "readTime": "string",
  "structuredQuery": {
    "endAt": {
      "before": false,
      "values": [
        {
          "arrayValue": {
            "values": [
              null
            ]
          },
          "booleanValue": false,
          "bytesValue": "string",
          "doubleValue": 0,
          "geoPointValue": {
            "latitude": 0,
            "longitude": 0
          },
          "integerValue": "string",
          "mapValue": {
            "fields": {}
          },
          "nullValue": "NULL_VALUE",
          "referenceValue": "string",
          "stringValue": "string",
          "timestampValue": "string"
        }
      ]
    },
    "from": [
      {
        "allDescendants": false,
        "collectionId": "string"
      }
    ],
    "limit": 0,
    "offset": 0,
    "orderBy": [
      {
        "direction": "DIRECTION_UNSPECIFIED",
        "field": {
          "fieldPath": "string"
        }
      }
    ],
    "select": {
      "fields": [
        {
          "fieldPath": "string"
        }
      ]
    },
    "startAt": {
      "before": false,
      "values": [
        {
          "arrayValue": {
            "values": [
              null
            ]
          },
          "booleanValue": false,
          "bytesValue": "string",
          "doubleValue": 0,
          "geoPointValue": {
            "latitude": 0,
            "longitude": 0
          },
          "integerValue": "string",
          "mapValue": {
            "fields": {}
          },
          "nullValue": "NULL_VALUE",
          "referenceValue": "string",
          "stringValue": "string",
          "timestampValue": "string"
        }
      ]
    },
    "where": {
      "compositeFilter": {
        "filters": [
          {}
        ],
        "op": "OPERATOR_UNSPECIFIED"
      },
      "fieldFilter": {
        "field": {
          "fieldPath": "string"
        },
        "op": "OPERATOR_UNSPECIFIED",
        "value": {
          "arrayValue": {
            "values": [
              null
            ]
          },
          "booleanValue": false,
          "bytesValue": "string",
          "doubleValue": 0,
          "geoPointValue": {
            "latitude": 0,
            "longitude": 0
          },
          "integerValue": "string",
          "mapValue": {
            "fields": {}
          },
          "nullValue": "NULL_VALUE",
          "referenceValue": "string",
          "stringValue": "string",
          "timestampValue": "string"
        }
      },
      "unaryFilter": {
        "field": {
          "fieldPath": "string"
        },
        "op": "OPERATOR_UNSPECIFIED"
      }
    }
  },
  "transaction": "string"
}

Response

Returns 200 with an object. Read it in later steps with {{firestoreProjectsDatabasesDocumentsRunQuery.response.data.<field>}}.

documentobject

A Firestore document. Must not exceed 1 MiB - 4 bytes.

createTimestring (google-datetime)

Output only. The time at which the document was created. This value increases monotonically when a document is deleted then recreated. It can also be compared to values from other documents and the `read_time` of a query.

fieldsobject

The document's fields. The map keys represent field names. A simple field name contains only characters `a` to `z`, `A` to `Z`, `0` to `9`, or `_`, and must not start with `0` to `9`. For example, `foo_bar_17`. Field names matching the regular expression `__.*__` are reserved. Reserved field names are forbidden except in certain documented contexts. The map keys, represented as UTF-8, must not exceed 1,500 bytes and cannot be empty. Field paths may be used in other contexts to refer to structured fields defined here. For `map_value`, the field path is represented by the simple or quoted field names of the containing fields, delimited by `.`. For example, the structured field `"foo" : { map_value: { "x&y" : { string_value: "hello" }}}` would be represented by the field path `foo.x&y`. Within a field path, a quoted field name starts and ends with `` ` `` and may contain any character. Some characters, including `` ` ``, must be escaped using a `\`. For example, `` `x&y` `` represents `x&y` and `` `bak\`tik` `` represents `` bak`tik ``.

namestring

The resource name of the document, for example `projects/{project_id}/databases/{database_id}/documents/{document_path}`.

updateTimestring (google-datetime)

Output only. The time at which the document was last changed. This value is initially set to the `create_time` then increases monotonically with each change to the document. It can also be compared to values from other documents and the `read_time` of a query.

doneboolean

If present, Firestore has completely finished the request and no more documents will be returned.

readTimestring (google-datetime)

The time at which the document was read. This may be monotonically increasing; in this case, the previous documents in the result stream are guaranteed not to have changed between their `read_time` and this one. If the query returns no results, a response with `read_time` and no `document` will be sent, and this represents the time at which the query was run.

skippedResultsinteger (int32)

The number of results that have been skipped due to an offset between the last response and the current response.

transactionstring (byte)

The transaction that was started as part of this request. Can only be set in the first response, and only if RunQueryRequest.new_transaction was set in the request. If set, no other fields will be set in this response.

json
{
  "document": {
    "createTime": "string",
    "fields": {},
    "name": "string",
    "updateTime": "string"
  },
  "done": false,
  "readTime": "string",
  "skippedResults": 0,
  "transaction": "string"
}

Need more? See the Firestore guide for connection setup and behaviour shared by every action.

Firestore.projects.databases.documents.run Query — Firestore — Documentation