Remove

Special variable useful to delete a field.

If any field is valued to this variable, the field is entirely deleted.

To unconditionally delete a field, see the exclude syntax sugar.

Example

class User(
val _id: ObjectId,
val name: String,
val isActive: Boolean,
)

users.aggregate()
.set {
User::name set cond(
condition = User::isActive,
ifTrue = User::name,
ifFalse = Remove,
)
}

External resources