MongoDB request DSL • opensavvy.ktmongo.dsl.options • WriteConcern • acknowledgment
acknowledgment¶
val acknowledgment: WriteAcknowledgment? = null
Describes how many nodes must acknowledge the write operation.
For the different options, see:
-
WriteAcknowledgment.Majority
: majority of the nodes. -
WriteAcknowledgment.Nodes
: a given number of nodes. -
WriteAcknowledgment.Tagged
: specific nodes selected ahead of time.
If this field is null
(default), the MongoDB default acknowledgment applies, which is WriteAcknowledgment.Majority
in most deployments.
Example¶
collections.updateMany(
options = {
writeConcern(WriteConcern(WriteAcknowledgment.Nodes(2))
}
) {
User::age inc 1
}
External resources¶
See also¶
WithWriteConcern.writeConcern
Specify this option.