Jump to top

FieldPath

interface

A FieldPath refers to a field in a document. The path may consist of a single field name (referring to a top-level field in the document), or a list of field names (referring to a nested field in the document).

Create a FieldPath by providing field names. If more than one field name is provided, the path will point to a nested field in a document.

Example
const user = await firebase.firestore().doc('users/alovelace').get();

// Create a new field path
const fieldPath = new firebase.firestore.FieldPath('address', 'zip');

console.log('Address ZIP Code', user.get(fieldPath));

Methods

isEqual

</>

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

isEqual(other: FieldPath): boolean;

documentId

</>

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

documentId(): FieldPath;