Skip to content

Documentation about optimistic locking could be more precise #5126

@michaldo

Description

@michaldo

https://docs.spring.io/spring-data/mongodb/reference/mongodb/template-crud-operations.html#mongo-template.optimistic-locking

There is an IMPORTANT section

Optimistic Locking requires to set the WriteConcern to ACKNOWLEDGED. Otherwise OptimisticLockingFailureException can be silently swallowed.

When I read this sentence, with great effort I configured WriteConcern  = ACKNOWLEDGED in my applications to enjoy Optimistic Locking.

I had to learn a bit more about Mongo to realize it was completely useless, because Mongo Servers default write concern is w:majority or w:1 what are different flavours of ACKNOWLEDGED

Maybe it is worth to mention about write concern. But this frame suggests is is very important to set write concern, when in reality is not true

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions