From 00a8da99711d32e6d3820c9c7f6795b2a1abfc9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=E2=80=9CCLOVIS=E2=80=9D=20Canet?= Date: Fri, 25 Oct 2024 23:08:44 +0200 Subject: [PATCH] docs(dsl): Document operator correspondance for UpdateExpression --- .../kotlin/expr/UpdateExpression.kt | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/dsl/src/commonMain/kotlin/expr/UpdateExpression.kt b/dsl/src/commonMain/kotlin/expr/UpdateExpression.kt index 3e893f5e..d333da76 100644 --- a/dsl/src/commonMain/kotlin/expr/UpdateExpression.kt +++ b/dsl/src/commonMain/kotlin/expr/UpdateExpression.kt @@ -31,6 +31,46 @@ import opensavvy.ktmongo.dsl.path.Path import kotlin.reflect.KClass import kotlin.reflect.KProperty1 +/** + * DSL for MongoDB operators that are used to update existing values (does *not* include aggregation operators). + * + * ### Example + * + * This expression type is available on multiple operations, most commonly `update`: + * ```kotlin + * class User( + * val name: String, + * val age: Int, + * ) + * + * collection.update( + * filter = { + * User::name eq "Bob" + * }, + * update = { + * User::age set 18 + * } + * ) + * ``` + * + * ### Operators + * + * Fields: + * - [`$inc`][inc] + * - [`$rename`][renameTo] + * - [`$set`][set] + * - [`$setOnInsert`][setOnInsert] + * - [`$unset`][unset] + * + * Arrays: + * - [`$[]`][FieldDsl.get] + * + * ### External resources + * + * - [Official documentation](https://www.mongodb.com/docs/manual/reference/operator/update/) + * + * @see FilterExpression Filters + */ @KtMongoDsl class UpdateExpression( context: BsonContext, -- 2.51.2