Path

data class Path(val segment: PathSegment, val parent: Path?)(source)

Low-level, type-unsafe pointer to a specific field in a document.

A path is a string pointer that identifies which field(s) are impacted by an operator.

For example, the following are valid paths:

  • "foo": targets the field "foo",

  • "foo.bar": targets the field "bar" which is part of the object "foo",

  • "arr.5.bar": targets the field "bar" which is part of the item with index 5 in the array "arr".

This structure is a singly-linked list representing the entire path. Each segment is represented by PathSegment.

The high-level type-safe equivalent of this type is Field.

Constructors

Link copied to clipboard
constructor(segment: PathSegment, parent: Path?)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val parent: Path?

The previous link in this Path.

Link copied to clipboard

Functions

Link copied to clipboard

Returns a Sequence of the different PathSegment instances that form this Path, in hierarchical order.

Link copied to clipboard

Returns a new Path instance that is the concatenation of the current path and a child path.

operator fun Path.div(segment: PathSegment): Path

Returns a new Path instance that is the concatenation of the current path and a segment.

Link copied to clipboard

Converts this MongoDB Path to a BsonPath.

Link copied to clipboard
open override fun toString(): String

Returns the string representation of this Path. This is the representation that is sent to MongoDB to refer to a Field.