Start listening after a specificread_time. The client must know the state of matching documents at this time.
↳ target_id
int
The target ID that identifies the target on the stream. Must be a positive number and non-zero. Iftarget_idis 0 (or unspecified), the server will assign an ID for this target and return that in aTargetChange::ADDevent. Once a target withtarget_id=0is added, all subsequent targets must also havetarget_id=0. If anAddTargetrequest withtarget_id != 0is sent to the server after a target withtarget_id=0is added, the server will immediately send a response with aTargetChange::Removeevent. Note that if the client sends multipleAddTargetrequests without an ID, the order of IDs returned inTargetChage.target_idsare undefined. Therefore, clients should provide a target ID instead of relying on the server to assign one. Iftarget_idis non-zero, there must not be an existing active target on this stream with the same ID.
↳ once
bool
If the target should be removed once it is current and consistent.
The number of documents that last matched the query at the resume token or read time. This value is only relevant when aresume_typeis provided. This value being present and greater than zero signals that the client wantsExistenceFilter.unchanged_namesto be included in the response.
The target ID that identifies the target on the stream. Must be a positive
number and non-zero.
Iftarget_idis 0 (or unspecified), the server will assign an ID for this
target and return that in aTargetChange::ADDevent. Once a target withtarget_id=0is added, all subsequent targets must also havetarget_id=0. If anAddTargetrequest withtarget_id != 0is
sent to the server after a target withtarget_id=0is added, the server
will immediately send a response with aTargetChange::Removeevent.
Note that if the client sends multipleAddTargetrequests
without an ID, the order of IDs returned inTargetChage.target_idsare
undefined. Therefore, clients should provide a target ID instead of relying
on the server to assign one.
Iftarget_idis non-zero, there must not be an existing active target on
this stream with the same ID.
Returns
Type
Description
int
setTargetId
The target ID that identifies the target on the stream. Must be a positive
number and non-zero.
Iftarget_idis 0 (or unspecified), the server will assign an ID for this
target and return that in aTargetChange::ADDevent. Once a target withtarget_id=0is added, all subsequent targets must also havetarget_id=0. If anAddTargetrequest withtarget_id != 0is
sent to the server after a target withtarget_id=0is added, the server
will immediately send a response with aTargetChange::Removeevent.
Note that if the client sends multipleAddTargetrequests
without an ID, the order of IDs returned inTargetChage.target_idsare
undefined. Therefore, clients should provide a target ID instead of relying
on the server to assign one.
Iftarget_idis non-zero, there must not be an existing active target on
this stream with the same ID.
Parameter
Name
Description
var
int
Returns
Type
Description
$this
getOnce
If the target should be removed once it is current and consistent.
Returns
Type
Description
bool
setOnce
If the target should be removed once it is current and consistent.
Parameter
Name
Description
var
bool
Returns
Type
Description
$this
getExpectedCount
The number of documents that last matched the query at the resume token or
read time.
This value is only relevant when aresume_typeis provided. This value
being present and greater than zero signals that the client wantsExistenceFilter.unchanged_namesto be included in the response.
The number of documents that last matched the query at the resume token or
read time.
This value is only relevant when aresume_typeis provided. This value
being present and greater than zero signals that the client wantsExistenceFilter.unchanged_namesto be included in the response.
Returns
Type
Description
int|null
setExpectedCount
The number of documents that last matched the query at the resume token or
read time.
This value is only relevant when aresume_typeis provided. This value
being present and greater than zero signals that the client wantsExistenceFilter.unchanged_namesto be included in the response.
Sets the field by wrapping a primitive type in a Google\Protobuf\Int32Value object.
The number of documents that last matched the query at the resume token or
read time.
This value is only relevant when aresume_typeis provided. This value
being present and greater than zero signals that the client wantsExistenceFilter.unchanged_namesto be included in the response.
[[["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 Target (1.53.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.53.0 (latest)](/php/docs/reference/cloud-firestore/latest/V1.Target)\n- [1.52.0](/php/docs/reference/cloud-firestore/1.52.0/V1.Target)\n- [1.51.0](/php/docs/reference/cloud-firestore/1.51.0/V1.Target)\n- [1.50.0](/php/docs/reference/cloud-firestore/1.50.0/V1.Target)\n- [1.48.1](/php/docs/reference/cloud-firestore/1.48.1/V1.Target)\n- [1.47.3](/php/docs/reference/cloud-firestore/1.47.3/V1.Target)\n- [1.46.0](/php/docs/reference/cloud-firestore/1.46.0/V1.Target)\n- [1.45.2](/php/docs/reference/cloud-firestore/1.45.2/V1.Target)\n- [1.44.1](/php/docs/reference/cloud-firestore/1.44.1/V1.Target)\n- [1.43.3](/php/docs/reference/cloud-firestore/1.43.3/V1.Target)\n- [1.40.0](/php/docs/reference/cloud-firestore/1.40.0/V1.Target)\n- [1.39.0](/php/docs/reference/cloud-firestore/1.39.0/V1.Target)\n- [1.38.0](/php/docs/reference/cloud-firestore/1.38.0/V1.Target)\n- [1.37.7](/php/docs/reference/cloud-firestore/1.37.7/V1.Target)\n- [1.36.1](/php/docs/reference/cloud-firestore/1.36.1/V1.Target)\n- [1.35.0](/php/docs/reference/cloud-firestore/1.35.0/V1.Target)\n- [1.34.0](/php/docs/reference/cloud-firestore/1.34.0/V1.Target)\n- [1.33.0](/php/docs/reference/cloud-firestore/1.33.0/V1.Target)\n- [1.32.0](/php/docs/reference/cloud-firestore/1.32.0/V1.Target)\n- [1.31.0](/php/docs/reference/cloud-firestore/1.31.0/V1.Target)\n- [1.30.0](/php/docs/reference/cloud-firestore/1.30.0/V1.Target)\n- [1.28.0](/php/docs/reference/cloud-firestore/1.28.0/V1.Target)\n- [1.27.3](/php/docs/reference/cloud-firestore/1.27.3/V1.Target) \nReference documentation and code samples for the Cloud Firestore V1 Client class Target.\n\nA specification of a set of documents to listen to.\n\nGenerated from protobuf message `google.firestore.v1.Target`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Firestore \\\\ V1\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getQuery\n\nA target specified by a query.\n\n### hasQuery\n\n### setQuery\n\nA target specified by a query.\n\n### getDocuments\n\nA target specified by a set of document names.\n\n### hasDocuments\n\n### setDocuments\n\nA target specified by a set of document names.\n\n### getResumeToken\n\nA resume token from a prior\n[TargetChange](/php/docs/reference/cloud-firestore/latest/V1.TargetChange) for an identical target.\n\nUsing a resume token with a different target is unsupported and may fail.\n\n### hasResumeToken\n\n### setResumeToken\n\nA resume token from a prior\n[TargetChange](/php/docs/reference/cloud-firestore/latest/V1.TargetChange) for an identical target.\n\nUsing a resume token with a different target is unsupported and may fail.\n\n### getReadTime\n\nStart listening after a specific `read_time`.\n\nThe client must know the state of matching documents at this time.\n\n### hasReadTime\n\n### setReadTime\n\nStart listening after a specific `read_time`.\n\nThe client must know the state of matching documents at this time.\n\n### getTargetId\n\nThe target ID that identifies the target on the stream. Must be a positive\nnumber and non-zero.\n\nIf `target_id` is 0 (or unspecified), the server will assign an ID for this\ntarget and return that in a `TargetChange::ADD` event. Once a target with\n`target_id=0` is added, all subsequent targets must also have\n`target_id=0`. If an `AddTarget` request with `target_id != 0` is\nsent to the server after a target with `target_id=0` is added, the server\nwill immediately send a response with a `TargetChange::Remove` event.\nNote that if the client sends multiple `AddTarget` requests\nwithout an ID, the order of IDs returned in `TargetChage.target_ids` are\nundefined. Therefore, clients should provide a target ID instead of relying\non the server to assign one.\nIf `target_id` is non-zero, there must not be an existing active target on\nthis stream with the same ID.\n\n### setTargetId\n\nThe target ID that identifies the target on the stream. Must be a positive\nnumber and non-zero.\n\nIf `target_id` is 0 (or unspecified), the server will assign an ID for this\ntarget and return that in a `TargetChange::ADD` event. Once a target with\n`target_id=0` is added, all subsequent targets must also have\n`target_id=0`. If an `AddTarget` request with `target_id != 0` is\nsent to the server after a target with `target_id=0` is added, the server\nwill immediately send a response with a `TargetChange::Remove` event.\nNote that if the client sends multiple `AddTarget` requests\nwithout an ID, the order of IDs returned in `TargetChage.target_ids` are\nundefined. Therefore, clients should provide a target ID instead of relying\non the server to assign one.\nIf `target_id` is non-zero, there must not be an existing active target on\nthis stream with the same ID.\n\n### getOnce\n\nIf the target should be removed once it is current and consistent.\n\n### setOnce\n\nIf the target should be removed once it is current and consistent.\n\n### getExpectedCount\n\nThe number of documents that last matched the query at the resume token or\nread time.\n\nThis value is only relevant when a `resume_type` is provided. This value\nbeing present and greater than zero signals that the client wants\n`ExistenceFilter.unchanged_names` to be included in the response.\n\n### hasExpectedCount\n\n### clearExpectedCount\n\n### getExpectedCountValue\n\nReturns the unboxed value from `getExpectedCount()`\n\nThe number of documents that last matched the query at the resume token or\nread time.\nThis value is only relevant when a `resume_type` is provided. This value\nbeing present and greater than zero signals that the client wants\n`ExistenceFilter.unchanged_names` to be included in the response.\n\n### setExpectedCount\n\nThe number of documents that last matched the query at the resume token or\nread time.\n\nThis value is only relevant when a `resume_type` is provided. This value\nbeing present and greater than zero signals that the client wants\n`ExistenceFilter.unchanged_names` to be included in the response.\n\n### setExpectedCountValue\n\nSets the field by wrapping a primitive type in a Google\\\\Protobuf\\\\Int32Value object.\n\nThe number of documents that last matched the query at the resume token or\nread time.\nThis value is only relevant when a `resume_type` is provided. This value\nbeing present and greater than zero signals that the client wants\n`ExistenceFilter.unchanged_names` to be included in the response.\n\n### getTargetType\n\n### getResumeType"]]