class
FieldPath
Source: path.
A dot-separated path for navigating sub-objects within a document.
Methods
new FieldPath(...segments)
Constructs a Firestore Field 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}}`);
});
});
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
segments |
|
|
Sequence of field names that form this path. Value can be repeated. |
Methods
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
isEqual(other) → boolean
Returns true if this FieldPath is equal to the provided value.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
other |
any type |
|
The value to compare against. |
- Returns
-
booleantrue if this
FieldPathis equal to the provided value.