upsertOneWithPipeline
abstract fun upsertOneWithPipeline(options: ERROR CLASS: Symbol not found for UpdateOptions<Document>.() -> Unit = {}, filter: ERROR CLASS: Symbol not found for FilterQuery<Document>.() -> Unit = {}, update: ERROR CLASS: Symbol not found for UpdateWithPipelineQuery<Document>.() -> Unit)(source)
Updates a single document that matches filter according to the update pipeline.
If multiple documents match filter, only the first one is updated.
If no documents match filter, a new one is created.
Example
class User(
val name: String,
val age: Int,
)
collection.upsertOneWithPipeline(
filter = {
User::name eq "Patrick"
}
) {
set {
User::age set 15
}
}Content copied to clipboard
External resources
See also
Do nothing if the document doesn't already exist.