Options
All
  • Public
  • Public/Protected
  • All
Menu

Class GeoDocumentReference

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

Properties

_isWeb: boolean

Accessors

  • get id(): string
  • 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
      • Attaches a listener for GeoDocumentSnapshot events. You may either pass individual onNext and onError callbacks.

        Parameters

        • onNext: (snapshot: GeoDocumentSnapshot) => void

          A callback to be called every time a new GeoDocumentSnapshot is available.

        • Optional onError: (error: Error) => void

          A callback to be called if the listen fails or is cancelled. No further callbacks will occur.

            • (error: Error): void
            • Parameters

              • error: Error

              Returns void

        Returns () => void

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

          • (): void
          • Returns void

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

    Returns string

Methods

  • 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(): 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).

  • 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 = ...

      An object to configure the get behavior.

    Returns Promise<GeoDocumentSnapshot>

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

  • 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(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