Reference documentation and code samples for the Cloud Firestore Client class FieldPath.
Represents a path to a Firestore Document field.
Example:
use Google\Cloud\Firestore\FirestoreClient;
$firestore = new FirestoreClient();
$path = $firestore->fieldPath(['accounts', 'usd']);
Methods
__construct
fieldNames
array
A list of field names.
documentId
Create a field path indicating the document ID.
Example:
use Google\Cloud\Firestore\FieldPath;
$path = FieldPath::documentId();
fromString
Create a FieldPath from a string path.
Example:
use Google\Cloud\Firestore\FieldPath;
$path = FieldPath::fromString('path.to.field');
path
string
The field path string.
splitPath
bool
If false, the input path will not be split on .
. Defaults to true
.
child
Get a new FieldPath with the given path part appended to the current path.
Example:
$child = $path->child('element');
part
string
The child path part.
pathString
Get the current path as a string, with special characters escaped.
Example:
$string = $path->pathString();
string
path
Get the path elements.
array
__toString
Cast the path to a string.
string
Constants
SPECIAL_CHARS
Value: '/^[^*~\\/[\\]]+$/'
UNESCAPED_FIELD_NAME
Value: '/^[_a-zA-Z][_a-zA-Z0-9]*$/'