Class FieldPath (7.3.1)

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.

Example
  let 
  
 query 
  
 = 
  
 firestore 
 . 
 collection 
 ( 
 'col' 
 ); 
 let 
  
 fieldPath 
  
 = 
  
 new 
  
 FieldPath 
 ( 
 'f.o.o' 
 , 
  
 'bar' 
 ); 
 query 
 . 
 where 
 ( 
 fieldPath 
 , 
  
 '==' 
 , 
  
 42 
 ). 
 get 
 (). 
 then 
 ( 
 snapshot 
  
 = 
>  
 { 
  
 snapshot 
 . 
 forEach 
 ( 
 document 
  
 = 
>  
 { 
  
 console 
 . 
 log 
 ( 
 `Document contains {'f.o.o' : {'bar' : 42}}` 
 ); 
  
 }); 
 }); 
 

Methods

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}

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
Create a Mobile Website
View Site in Mobile | Classic
Share by: