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):
I think you might be able to implement the conditional primitive matching now, without breaking changes, but allowing for string matching of "true" and "false" would be a breaking change for the next major version.
true
false
null
"true"
"false"
"null"
These are all valid JSON values, but can't all be queried at present. Right now,
true
andfalse
are being cast to their primitive types when supplied as string queries (andnull
is not):https://github.com/vasanthv/jsonbox/blob/6781bd24a2e292fe3ea2cd33c76a52d99f801b99/src/helper.js#L84-L85
I think it might be better to treat these non-string primitive values the way that numbers are being treated, but as special cases:
https://github.com/vasanthv/jsonbox/blob/6781bd24a2e292fe3ea2cd33c76a52d99f801b99/src/helper.js#L71
I haven't worked with mongo in a long time, so I'm not sure about the exact syntax, but something like
and then you could just remove the code from lines 84–85 above.