Mutable version of DocumentPath allowing you to mutate a document at a specific key-path. You don't create a MutableDocumentPath directly but obtain one via the path property or the at() method of MutableDocument.

Not available in React Native environments.

Properties

mutableDocument: MutableDocument

The (mutable) document this path belongs to.

path: string

The full document path so far.

Accessors

  • get attachmentToken(): AttachmentToken
  • Returns the value at the previously specified key in the document as a AttachmentToken if possible, otherwise returns null.

    Returns AttachmentToken

    when called in a React Native environment.

  • get counter(): MutableCounter
  • Returns the value at the previously specified key in the document as a MutableCounter if possible, otherwise returns null.

    Returns MutableCounter

    when called in a React Native environment.

  • get register(): MutableRegister
  • Returns the value at the previously specified key in the document as a MutableRegister if possible, otherwise returns null.

    Returns MutableRegister

    when called in a React Native environment.

  • get value(): any
  • Traverses the document with the key-path represented by the receiver and returns the corresponding object or value.

    Returns any

    when called in a React Native environment.

Methods

  • Returns a new mutable document path instance with the passed in key-path or index appended.

    A key-path can be a single property name or multiple property names separated by a dot. Indexes can also be specified as part of the key path using square brackets syntax. The empty string returns a document path representing the same portion of the document as the receiver. If a key path starts with a property name and is prefixed by a dot, the dot is ignored.

    Examples:

    • mutableDocumentPath.at('mileage')
    • mutableDocumentPath.at('driver.name')
    • mutableDocumentPath.at('passengers[2]')
    • mutableDocumentPath.at('passengers[2].belongings[1].kind')
    • mutableDocumentPath.at('.mileage')

    Parameters

    • keyPathOrIndex: string | number

    Returns MutableDocumentPath

    when called in a React Native environment.

  • Removes a value at the document's key-path defined by the receiver.

    Returns void

    when called in a React Native environment.

  • Sets a value at the document's key-path defined by the receiver.

    Parameters

    • value: any
    • OptionalisDefault: boolean

      Represents whether or not the value should be set as a default value. Set this to true if you want to set a default value that you expect to be overwritten by other devices in the network. The default value is false.

    Returns void

    when called in a React Native environment.