From f6f9978fb5e95018bbba06167de47afe4ae8e4bb Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Mon, 12 Jan 2026 16:15:17 +0100 Subject: [PATCH] Refine optimistic locking WriteConcern wording. Reflect the actual intent. Closes #5126 --- .../modules/ROOT/pages/mongodb/template-crud-operations.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/antora/modules/ROOT/pages/mongodb/template-crud-operations.adoc b/src/main/antora/modules/ROOT/pages/mongodb/template-crud-operations.adoc index 7ec06a69b..482fb9f0e 100644 --- a/src/main/antora/modules/ROOT/pages/mongodb/template-crud-operations.adoc +++ b/src/main/antora/modules/ROOT/pages/mongodb/template-crud-operations.adoc @@ -691,7 +691,7 @@ template.save(tmp); // throws OptimisticLockingFailureException Only certain CRUD operations on `MongoTemplate` do consider and alter version properties. Please consult `MongoOperations` java doc for detailed information. -IMPORTANT: Optimistic Locking requires to set the `WriteConcern` to `ACKNOWLEDGED`. Otherwise `OptimisticLockingFailureException` can be silently swallowed. +NOTE: Optimistic Locking requires write acknowledgement (a write result response) by the server. Using `WriteConcern.UNACKNOWLEDGED` can lead to silently swallowed `OptimisticLockingFailureException`. NOTE: As of Version 2.2 `MongoOperations` also includes the `@Version` property when removing an entity from the database. To remove a `Document` without version check use `MongoOperations#remove(Query,...)` instead of `MongoOperations#remove(Object)`.