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 _document

_document: DocumentReference | DocumentReference

The DocumentReference instance.

Private _isWeb

_isWeb: boolean

Accessors

firestore

id

  • get id(): string

onSnapshot

  • get onSnapshot(): function
  • Attaches a listener for GeoDocumentSnapshot events. You may either pass individual onNext and onError callbacks.

    Returns function

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

      • (onNext: function, onError?: function): function
      • Parameters

        • onNext: function

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

        • Optional onError: function

          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 function

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

    • Default value 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

  • Returns true if this GeoDocumentReference is equal to the provided one.

    Parameters

    Returns boolean

    true if this DocumentReference or GeoDocumentReference is equal to the provided one.

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

    • data: 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