The Firebase JS SDK is now in BETA!
This EAP site is no longer maintained. See the official Firebase Documentation site for the latest documentation and information about the Firebase JS SDK.

Home > @firebase/firestore > lite > DocumentSnapshot > get

DocumentSnapshot.get() method

Retrieves the field specified by fieldPath. Returns undefined if the document or field doesn't exist.

Signature:

get(fieldPath: string | FieldPath): any;

Parameters

Parameter Type Description
fieldPath string | FieldPath The path (for example 'foo' or 'foo.bar') to a specific field.

Returns:

any

The data at the specified field location or undefined if no such field exists in the document.