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.

Use DQL (Ditto Query Language) instead. For more information see: https://ditto.com/link/dql-legacy-to-dql-adoption

Properties

mutableDocument: MutableDocument

The (mutable) document this path belongs to.

Use DQL (Ditto Query Language) instead. For more information see: https://ditto.com/link/dql-legacy-to-dql-adoption

path: string

The full document path so far.

Use DQL (Ditto Query Language) instead. For more information see: https://ditto.com/link/dql-legacy-to-dql-adoption

Accessors

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

    Use DQL (Ditto Query Language) instead. For more information see: https://ditto.com/link/dql-legacy-to-dql-adoption

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.

    Use DQL (Ditto Query Language) instead. For more information see: https://ditto.com/link/dql-legacy-to-dql-adoption

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

    Returns void

    when called in a React Native environment.

    Use DQL (Ditto Query Language) instead. For more information see: https://ditto.com/link/dql-legacy-to-dql-adoption

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

    Use DQL (Ditto Query Language) instead. For more information see: https://ditto.com/link/dql-legacy-to-dql-adoption