[SERVER-55286] $regex operator inside a Spring Boot @Query annotation unsuccessful Created: 18/Mar/21 Updated: 19/Mar/21 Resolved: 19/Mar/21 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Pavel Antonov | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Operating System: | ALL |
| Steps To Reproduce: | I would like to retrieve every document with a patchName(String), which contains a given phrase. E.g. "When the user submits a keyword "S2A", he will acquire all matching documents with patch names i.e., "patchName" : "S2A_MSIL2A_20170613T101031_0_64". Since I would like that the phrase is contained into the patch name, I decided to go with $regex, since a text index searches only exact phrases. I managed it to submit the query in the mongodb shell, however, I am not able to reproduce it inside the Spring Boot Repository class at server-side. Hereby I attach some screenshots:
And here is the analogous query, submitted from Spring Boot Repository class:
And this is how I invoke it (p.s. I tried several approaches, but still nothing):
Whichever approach I take, it still does not work. Even if I submit the exact patch name of the document, it does not retrieve it. Hereby I provide you with two example documents (the data originates from the BigEarthNet archive (http://bigearth.net/): { , { ,
|
| Participants: |
| Description |
|
Hello,
I have spent hours trying to successfully submit a $regex driven query using the Java Spring Boot @Query annotation. I also tried with the generated query methods based on names, however, still nothing. I have already searched in the documentation and throughout the Internet, but I could not identify my mistake. Could anyone back me up on this one?
Regards, Pavel Antonov |
| Comments |
| Comment by Eric Sedor [ 19/Mar/21 ] |
|
Glad to hear you found the issue paveldushev9@gmail.com, thanks for updating us. In the future, if you're having a problem but don't yet suspect a bug in the MongoDB core server itself, we tend to recommend asking our community for help by posting on the MongoDB Developer Community Forums. If the discussion there leads you to suspect a bug in the MongoDB server, then we'd want to discuss here in the SERVER project. Thanks, |
| Comment by Pavel Antonov [ 19/Mar/21 ] |
|
There was actually a hidden issue in my back-end. Everything works as expected. Feel free to delete the ticket. Sorry for bothering! |