This repository was archived by the owner on May 25, 2023. It is now read-only.

Description
true
false
null
"true"
"false"
"null"
These are all valid JSON values, but can't all be queried at present. Right now, true and false are being cast to their primitive types when supplied as string queries (and null is not):
q=booleanField1:true,booleanField2:false
|
if (value == 'true') query['data.' + key] = true; |
|
else if (value == 'false') query['data.' + key] = false; |
I think it might be better to treat these non-string primitive values the way that numbers are being treated, but as special cases:
q=booleanField1:=true,booleanField2:=false,fieldWithNoValue:=null
|
else if (value.startsWith('=')) query['data.' + key] = +val; |
I haven't worked with mongo in a long time, so I'm not sure about the exact syntax, but something like
else if (value.startsWith('=')) {
if (val === 'true') query['data.' + key] = true;
else if (val === 'false') query['data.' + key] = false;
else if (val === 'null') query['data.' + key] = null;
else query['data.' + key] = +val;
}
and then you could just remove the code from lines 84–85 above.