-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Criteria.regex
is converted to String
when applying to ID fields
#4674
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
Thank you for getting in touch. It would help us investigating the issue if you could take the time to provide a complete minimal sample (something that we can unzip or git clone, build, and deploy) that reproduces the problem. |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
Hi, I don't have the time right now for a full example, maybe next week. Just create a query with a regexp on the key column, i.e.:
This wont return any value because the regexp expression is lost due to conversion. |
I built an example reproducing the problem: In summary, the issue arises when filtering a collection by the Using spring boot 3.2.0+ the bug is reproduced, but using 3.1.11 it works ok. I tried to enforce the spring-data-mongodb dependency version only, to 4.1.x, which is the working one, but the problem persists, so maybe the problem it's not fully up to this lib. Code overview:
This should be the output when working ok:
but actually it prints nothing because this returns an empty list. The attached example will be working as soon as you change spring boot parent to 3.1.11. The collection is initialized this way in a
|
Hi, is there any updates on this issue? I also encountering the same issue ever since upgrading to springboot 3.2.0 with spring data mongodb 4.3.0 |
@nandosangputra thanks for the ping. |
thank you @spekdrum for the reproducer - I do see the error now which comes in when there's a combination of |
Criteria.regex
is converted to String
when applying to ID fields
Hi, this issue #4649 is still happening in 4.2.4 with ID fields.
In
QueryMapper#getMappedValue
method,applyFiledTargetTypeHitToValue()
returns the Pattern object correctly after the fix, but later ends callingQueryMapper#convertId()
method, which ends callinggetConversionService().canConvert()
inMongoConverter.convertId()
method. This is returning true, so Pattern is converted to String anyway.The text was updated successfully, but these errors were encountered: