-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Update using $inc does not work if @Version is present in the entity #4918
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
For info, generating manually the update with MongoTemplate and criteria: public void incrementExecutedLinesAndSuccessfullyExecutedLinesById(
ObjectId id,
int executedLines,
int successfullyExecutedLines
) {
Query query = Query.query(Criteria.where("_id").is(id));
Update update = new Update()
.inc("executedLines", executedLines)
.inc("successfullyExecutedLines", successfullyExecutedLines);
mongoTemplate.updateFirst(query, update, EntitlementJobExecution.class);
}; Works as expected:
So this problem concern only MongoRepository |
Thank you for reporting - we'll look into it. |
The issue revealed a general problem with |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Given following entity:
and the following repository:
The query does not work as expected. No error is reported, but it generates:
Thus, executedLines and successfullyExecutedLines are not updated.
If I remove @Version from entity, it works as expected.
Thanks
The text was updated successfully, but these errors were encountered: