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
Name Description
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
Type Description
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
Name Description
segments string[]

Sequence of field names.

Returns
Type Description
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
Type Description
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
Name Description
fieldPath string | FirebaseFirestore.FieldPath

The FieldPath to create.

Returns
Type Description
FieldPath

{FieldPath} A field path representation.

isEqual(other)

  isEqual 
 ( 
 other 
 : 
  
 FieldPath 
 ) 
 : 
  
 boolean 
 ; 
 

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

Parameter
Name Description
other FieldPath

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

Returns
Type Description
boolean

split(fieldPath)

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

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

Parameter
Name Description
fieldPath string

The path to split.

Returns
Type Description
string[]

{Array.

toString()

  toString 
 () 
 : 
  
 string 
 ; 
 

Returns a string representation of this path.

Returns
Type Description
string

A string representing this path.

Create a Mobile Website
View Site in Mobile | Classic
Share by: