Open miguel-melo-impactzero opened 1 year ago
/cc @FroMage(panache), @evanchooly(mongodb), @loicmathieu(mongodb,panache)
@miguel-melo-impactzero if I understand it correctly you want to pass a compex object as parameter and have the field (or the getter) or the object used to set the parameter ? This is not supported, we only support single objet as parameter (primitive, String, date), if an objet is passed as a parameter it's toString() method is called. You must pass each parameter values as separate parameter
@loicmathieu Hi, thanks for the response. Actually no, I am using wrapper classes and also have a list being passed to the parameter map and the way i implemented it works fine but using the normal way as I described causes a ParseException. I am using short 2-3 letter alias and it works fine but I had to build that workaround and it feels a bit disjointed.
As I have now I create the query string to be queryString = "xyz.abc = :aa" and the map has an entry ("aa", List<String) and it works fine, no complex object is on the param(which may or may not be a problem since I have objects on the db that I may need to filter with).
My best guess it that the param indicator on the query string cannot have some characters, in this case the dot(.), as it may have a different function for the parser or the query itself.
@miguel-melo-impactzero I'm not sure but I didn't remember parsing the parameter names. Maybe if you can create a reproducer I could have a look
@loicmathieu I think I faced the same issue. I've created a project where I've generated the issue. Let me know if you need anything else.
https://github.com/minhaz1217/java-quarkus/tree/master/quarkus-parameter-map-issue
Same here. It appears that if a parameter is null, then the error 'JSON reader was expecting a value but found ':'' appears. Of course it would be nice that the passed parameters hashmap could contain nulls.
Describe the bug
Panache to query a Mongodb using the find(string,map) function does not work as expected.
Using the find(string,map) I provide a string as such "xyz.abc = :xyz.abc" and map with key "xyz.abc" and value "teste value" as string.
This find method needs to be dynamic depending on input from user.
Expected behavior
Panache is able to build the query and then perform it.
Actual behavior
Error is throw from Bson with message "org.bson.json.JsonParseException: JSON reader was expecting a value but found ':'."
How to Reproduce?
1) Create a Panache repository 2) Create a query string queryString 3) queryString = "xyz.abc = :xyz.abc"; 4) Create a Map<String,Object> queryParams 5) queryParams.put("xyz.abc","teste param"); 6) find(queryString, queryParams)
Output of
uname -a
orver
No response
Output of
java -version
1.8
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.15.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)mvnw
Additional information
No response