Options
All
  • Public
  • Public/Protected
  • All
Menu

A GeoDocumentReference refers to a document location in a Firestore database and can be used to write, read, or listen to the location. The document at the referenced location may or may not exist. A GeoDocumentReference can also be used to create a CollectionReference to a subcollection.

Hierarchy

  • GeoDocumentReference

Index

Constructors

constructor

Properties

Private _isWeb

_isWeb: boolean

Accessors

firestore

id

  • get id(): string

native

onSnapshot

  • get onSnapshot(): (onNext: (snapshot: GeoDocumentSnapshot) => void, onError?: (error: Error) => void) => () => void
  • Attaches a listener for GeoDocumentSnapshot events. You may either pass individual onNext and onError callbacks.

    Returns (onNext: (snapshot: GeoDocumentSnapshot) => void, onError?: (error: Error) => void) => () => void

    An unsubscribe function that can be called to cancel the snapshot listener.

      • (onNext: (snapshot: GeoDocumentSnapshot) => void, onError?: (error: Error) => void): () => void
      • Parameters

        Returns () => void

          • (): void
          • Returns void

parent

path

  • get path(): string
  • A string representing the path of the referenced document (relative to the root of the database).

    Returns string

Methods

collection

  • Gets a GeoCollectionReference instance that refers to the collection at the specified path.

    Parameters

    • collectionPath: string

      A slash-separated path to a collection.

    Returns GeoCollectionReference

    The GeoCollectionReference instance.

delete

  • delete(): Promise<void>
  • Deletes the document referred to by this GeoDocumentReference.

    Returns Promise<void>

    A Promise resolved once the document has been successfully deleted from the backend (Note that it won't resolve while you're offline).

get

  • Reads the document referred to by this GeoDocumentReference.

    Note: By default, get() attempts to provide up-to-date data when possible by waiting for data from the server, but it may return cached data or fail if you are offline and the server cannot be reached. This behavior can be altered via the GetOptions parameter.

    Parameters

    • options: GetOptions = {source: 'default'}

      An object to configure the get behavior.

    Returns Promise<GeoDocumentSnapshot>

    A Promise resolved with a GeoDocumentSnapshot containing the current document contents.

isEqual

set

  • Writes to the document referred to by this GeoDocumentReference. If the document does not yet exist, it will be created. If you pass SetOptions, the provided data can be merged into an existing document.

    Parameters

    • documentData: DocumentData

      A map of the fields and values for the document.

    • Optional options: SetOptions

      An object to configure the set behavior. Includes custom key for location in document.

    Returns Promise<void>

    A Promise resolved once the data has been successfully written to the backend (Note it won't resolve while you're offline).

update

  • update(data: UpdateData, customKey?: string): Promise<void>
  • Updates fields in the document referred to by this GeoDocumentReference. The update will fail if applied to a document that does not exist.

    Parameters

    • data: UpdateData

      An object containing the fields and values with which to update the document. Fields can contain dots to reference nested fields within the document.

    • Optional customKey: string

      The key of the document to use as the location. Otherwise we default to coordinates.

    Returns Promise<void>

    A Promise resolved once the data has been successfully written to the backend (Note it won't resolve while you're offline).

Generated using TypeDoc