Class FieldPath (4.9.8)

A dot-separated path for navigating sub-objects (e.g. nested maps) within a document.

Inheritance

Path<FieldPath> > FieldPath

Package

@google-cloud/firestore!

Constructors

(constructor)(segments)

constructor(...segments: string[]);

Constructs a Firestore Field Path.

Parameter
NameDescription
segments string[]

Sequence of field names that form this path.

Properties

formattedName

/** @override */
get formattedName(): string;

String representation of a FieldPath as expected by the API.

Property Value
TypeDescription
string

Methods

construct(segments)

/** @override */
construct(segments: string[]): FieldPath;

Constructs a new instance of FieldPath. We need this instead of using the normal constructor because polymorphic 'this' doesn't work on static methods.

Parameter
NameDescription
segments string[]

Sequence of field names.

Returns
TypeDescription
FieldPath

The newly created FieldPath.

documentId()

static documentId(): FieldPath;

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
TypeDescription
FieldPath

{FieldPath}

fromArgument(fieldPath)

static fromArgument(fieldPath: string | firestore.FieldPath): FieldPath;

Turns a field path argument into a [FieldPath]FieldPath. Supports FieldPaths as input (which are passed through) and dot-separated strings.

Parameter
NameDescription
fieldPath string | FirebaseFirestore.FieldPath

The FieldPath to create.

Returns
TypeDescription
FieldPath

{FieldPath} A field path representation.

isEqual(other)

isEqual(other: FieldPath): boolean;

Returns true if this FieldPath is equal to the provided value.

Parameter
NameDescription
other FieldPath

The value to compare against. {boolean} true if this FieldPath is equal to the provided value.

Returns
TypeDescription
boolean

split(fieldPath)

/** @override */
split(fieldPath: string): string[];

Splits a string into path segments, using dots as separators.

Parameter
NameDescription
fieldPath string

The path to split.

Returns
TypeDescription
string[]

{Array.

toString()

toString(): string;

Returns a string representation of this path.

Returns
TypeDescription
string

A string representing this path.