Skip to content

MongoDB request DSLopensavvy.ktmongo.dsl.path

Package-level declarations

Utilities for referencing variables and classes.

User::_id                          // _id
User::profile / Profile::name      // profile.name
User::friends[1] / Friend::name    // friends.$1.name

This package contains a low-level type-unsafe implementation of arbitrary document paths, and a high-level type-safe wrapper that provides the above utility functions.

Note that some functions are only provided when the FieldDsl is into scope (which should be done automatically by most operators). This means that you should rarely need to import anything for these functions to be available.

Operators

  • opensavvy.ktmongo.dsl.path.Field.div

  • opensavvy.ktmongo.dsl.path.get

Types

Field

interface Field<in Root, out Type>

High-level, typesafe pointer to a specific field in a document.

FieldDsl

interface FieldDsl

DSL to refer to fields, usually automatically added into scope by operators.

Path

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

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

PathSegment

sealed class PathSegment

Single segment in a Path.

PropertyNameStrategy

Allows configuring how the DSL generates property paths from

Functions

div

operator fun Path.div(path: Path): Path

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.

Path

fun Path(root: String): Path

Creates a root path from the provided root field name.