Class FieldPath (2.18.0)

FieldPath(*parts)

Field Path object for client use.

A field path is a sequence of element keys, separated by periods. Each element key can be either a simple identifier, or a full unicode string.

In the string representation of a field path, non-identifier elements must be quoted using backticks, with internal backticks and backslashes escaped with a backslash.

Methods

__add__

__add__(other)

Adds other field path to end of this field path.

Parameter
Name Description
other FieldPath, str

The field path to add to the end of this FieldPath.

document_id

document_id()

A special FieldPath value to refer to the ID of a document. It can be used in queries to sort or filter by the document ID.

Returns: A special sentinel value to refer to the ID of a document.

eq_or_parent

eq_or_parent(other)

Check whether other is an ancestor.

from_api_repr

from_api_repr(api_repr: str)

Factory: create a FieldPath from the string formatted per the API.

Parameter
Name Description
api_repr str

a string path, with non-identifier elements quoted

Exceptions
Type Description
ValueErro if the parsing fails:

from_string

from_string(path_string: str)

Factory: create a FieldPath from a unicode string representation.

This method splits on the character . and disallows the characters ``*/[]. To create a FieldPath whose components have those characters, call the constructor.

Parameter
Name Description
path_string str

A unicode string which cannot contain

lineage

lineage()

Return field paths for all parents.

Returns: Set[FieldPath]

to_api_repr

to_api_repr()

Render a quoted string representation of the FieldPath