You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bulk operations use a low-level bulk mechanism to run a batch of insert/update/upsert/delete operations. Optimistic locking doesn't work well in such a scenario because the actual update happens at a later time while versioning details need to be maintained meanwhile.
We do not have a mechanism to return immutable updated objects because the API for insert returns BulkOperations. You can end up with a state where the object is prepared for an insert with the version counter incremented, but you never executed the bulk and so your in-memory state is inconsistent.
Updating objects isn't supported either through the Bulk API as Bulk updates require Update and Query objects instead of entities.
mp911de
changed the title
Annotation @version is not working in mongodb BulkOperations insert operation
Document BulkOperations limitations
Aug 23, 2022
Annotation
@version
is not working in mongodb BulkOperations insert operation but working with mongoRepository insert.Below is the code for BulkOperations and MongoRepository:
Full file:
https://github.com/sriramkishoren/spring-boot-mongo-version-issue/blob/main/src/main/java/org/example/controller/DocumentsController.java
Below is the entity class
Full file:
https://github.com/sriramkishoren/spring-boot-mongo-version-issue/blob/main/src/main/java/org/example/entity/Documents.java
Issue Screenshot Link:
https://github.com/sriramkishoren/spring-boot-mongo-version-issue/blob/main/Screen%20Shot%202022-06-12%20at%2010.08.41%20AM.png
The text was updated successfully, but these errors were encountered: