Details
Description
zendesk ticket from customer below - is there existing functionality for this and it is simply not documented?
The method Query.setKey( String ) converts strings consisting of digits into numbers instead of keeping the format a string. This can be seen by inspecting the Query object after running setKey( "300" ) (or any other all digit string). The internal association is ?key=300. For example, setKey( "Hey" ) yields ?key="Hey".
The issue here is that we have data stored in JSON documents where the data portion is treated as a string, but it is all digits. So, a query for setKey( "300" ) fails to match fields that contain "300", because the query is ultimately if ( 300 == "300" ).
There should be two versions of setKey(), one for strings and one for number types.
I was unable to find any documentation regarding this particular case, so I assumed it is not an expected issue.
The problem is inside of the Query class. In getArg(), the check for isJsonObject() returns true for stringified numbers, and the resulting key/value does not contain quotes. The result now is
?key=300
We want the output of the query object to be
?key="300"
or
?key=300
based on the input type (String or number). As of now, it makes that determination for us, which is incorrect.
which is impossible given the current implementation.