The document's fields. The map keys represent field names. Field names matching the regular expression __.*__ are reserved. Reserved field names are forbidden except in certain documented contexts. The field names, 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 a dot-delimited (.) string of segments. Each segment is either a simple field name (defined below) or a quoted field name. For example, the structured field "foo" : { map_value: { "x&y" : { string_value: "hello" }}} would be represented by the field path foo.`x&y` . 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. 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.
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.
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.
getName
The resource name of the document, for example
projects/{project_id}/databases/{database_id}/documents/{document_path}.
Returns
Type
Description
string
setName
The resource name of the document, for example
projects/{project_id}/databases/{database_id}/documents/{document_path}.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getFields
The document's fields.
The map keys represent field names.
Field names matching the regular expression __.*__ are reserved. Reserved
field names are forbidden except in certain documented contexts. The field
names, 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 a
dot-delimited (.) string of segments. Each segment is either a simple
field name (defined below) or a quoted field name. For example, the
structured field "foo" : { map_value: { "x&y" : { string_value: "hello"
}}} would be represented by the field path foo.`x&y` .
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.
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.
The map keys represent field names.
Field names matching the regular expression __.*__ are reserved. Reserved
field names are forbidden except in certain documented contexts. The field
names, 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 a
dot-delimited (.) string of segments. Each segment is either a simple
field name (defined below) or a quoted field name. For example, the
structured field "foo" : { map_value: { "x&y" : { string_value: "hello"
}}} would be represented by the field path foo.`x&y` .
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.
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.
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.
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.
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.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Cloud Firestore V1 Client - Class Document (1.53.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.53.0 (latest)](/php/docs/reference/cloud-firestore/latest/V1.Document)\n- [1.52.0](/php/docs/reference/cloud-firestore/1.52.0/V1.Document)\n- [1.51.0](/php/docs/reference/cloud-firestore/1.51.0/V1.Document)\n- [1.50.0](/php/docs/reference/cloud-firestore/1.50.0/V1.Document)\n- [1.48.1](/php/docs/reference/cloud-firestore/1.48.1/V1.Document)\n- [1.47.3](/php/docs/reference/cloud-firestore/1.47.3/V1.Document)\n- [1.46.0](/php/docs/reference/cloud-firestore/1.46.0/V1.Document)\n- [1.45.2](/php/docs/reference/cloud-firestore/1.45.2/V1.Document)\n- [1.44.1](/php/docs/reference/cloud-firestore/1.44.1/V1.Document)\n- [1.43.3](/php/docs/reference/cloud-firestore/1.43.3/V1.Document)\n- [1.40.0](/php/docs/reference/cloud-firestore/1.40.0/V1.Document)\n- [1.39.0](/php/docs/reference/cloud-firestore/1.39.0/V1.Document)\n- [1.38.0](/php/docs/reference/cloud-firestore/1.38.0/V1.Document)\n- [1.37.7](/php/docs/reference/cloud-firestore/1.37.7/V1.Document)\n- [1.36.1](/php/docs/reference/cloud-firestore/1.36.1/V1.Document)\n- [1.35.0](/php/docs/reference/cloud-firestore/1.35.0/V1.Document)\n- [1.34.0](/php/docs/reference/cloud-firestore/1.34.0/V1.Document)\n- [1.33.0](/php/docs/reference/cloud-firestore/1.33.0/V1.Document)\n- [1.32.0](/php/docs/reference/cloud-firestore/1.32.0/V1.Document)\n- [1.31.0](/php/docs/reference/cloud-firestore/1.31.0/V1.Document)\n- [1.30.0](/php/docs/reference/cloud-firestore/1.30.0/V1.Document)\n- [1.28.0](/php/docs/reference/cloud-firestore/1.28.0/V1.Document)\n- [1.27.3](/php/docs/reference/cloud-firestore/1.27.3/V1.Document) \nReference documentation and code samples for the Cloud Firestore V1 Client class Document.\n\nA Firestore document.\n\nMust not exceed 1 MiB - 4 bytes.\n\nGenerated from protobuf message `google.firestore.v1.Document`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Firestore \\\\ V1\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getName\n\nThe resource name of the document, for example\n`projects/{project_id}/databases/{database_id}/documents/{document_path}`.\n\n### setName\n\nThe resource name of the document, for example\n`projects/{project_id}/databases/{database_id}/documents/{document_path}`.\n\n### getFields\n\nThe document's fields.\n\nThe map keys represent field names.\nField names matching the regular expression `__.*__` are reserved. Reserved\nfield names are forbidden except in certain documented contexts. The field\nnames, represented as UTF-8, must not exceed 1,500 bytes and cannot be\nempty.\nField paths may be used in other contexts to refer to structured fields\ndefined here. For `map_value`, the field path is represented by a\ndot-delimited (`.`) string of segments. Each segment is either a simple\nfield name (defined below) or a quoted field name. For example, the\nstructured field `\"foo\" : { map_value: { \"x&y\" : { string_value: \"hello\"\n}}}` would be represented by the field path ``foo.`x&y` ``.\nA simple field name contains only characters `a` to `z`, `A` to `Z`,\n`0` to `9`, or `_`, and must not start with `0` to `9`. For example,\n`foo_bar_17`.\nA quoted field name starts and ends with ``` `` and\nmay contain any character. Some characters, including ``` ``, must be\nescaped using a `\\`. For example, ```x&y` `` represents `x&y` and\n```bak\\`tik` `` represents ``bak`tik``.\n\n### setFields\n\nThe document's fields.\n\nThe map keys represent field names.\nField names matching the regular expression `__.*__` are reserved. Reserved\nfield names are forbidden except in certain documented contexts. The field\nnames, represented as UTF-8, must not exceed 1,500 bytes and cannot be\nempty.\nField paths may be used in other contexts to refer to structured fields\ndefined here. For `map_value`, the field path is represented by a\ndot-delimited (`.`) string of segments. Each segment is either a simple\nfield name (defined below) or a quoted field name. For example, the\nstructured field `\"foo\" : { map_value: { \"x&y\" : { string_value: \"hello\"\n}}}` would be represented by the field path ``foo.`x&y` ``.\nA simple field name contains only characters `a` to `z`, `A` to `Z`,\n`0` to `9`, or `_`, and must not start with `0` to `9`. For example,\n`foo_bar_17`.\nA quoted field name starts and ends with ``` `` and\nmay contain any character. Some characters, including ``` ``, must be\nescaped using a `\\`. For example, ```x&y` `` represents `x&y` and\n```bak\\`tik` `` represents ``bak`tik``.\n\n### getCreateTime\n\nOutput only. The time at which the document was created.\n\nThis value increases monotonically when a document is deleted then\nrecreated. It can also be compared to values from other documents and\nthe `read_time` of a query.\n\n### hasCreateTime\n\n### clearCreateTime\n\n### setCreateTime\n\nOutput only. The time at which the document was created.\n\nThis value increases monotonically when a document is deleted then\nrecreated. It can also be compared to values from other documents and\nthe `read_time` of a query.\n\n### getUpdateTime\n\nOutput only. The time at which the document was last changed.\n\nThis value is initially set to the `create_time` then increases\nmonotonically with each change to the document. It can also be\ncompared to values from other documents and the `read_time` of a query.\n\n### hasUpdateTime\n\n### clearUpdateTime\n\n### setUpdateTime\n\nOutput only. The time at which the document was last changed.\n\nThis value is initially set to the `create_time` then increases\nmonotonically with each change to the document. It can also be\ncompared to values from other documents and the `read_time` of a query."]]