You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
qs.parse({"foo":">1"}) results in {"foo":{"$gt":1}} and not {"foo":{"$gt":"1"}} where the '1' is converted to a Number field automatically. If the foo field is a string field in the database than this search query will find nothing.
I haven't tested it but this will probably also be true for booleans. So you probably can't filter a text field on the word 'true'.
There should be a way to force the creation of a string filter for values that could also be a number or a boolean.
The text was updated successfully, but these errors were encountered:
That is correct behaviour with the default settings. You can turn off automatic parsing of Numbers and Booleans by setting toNumber and toBoolean respectively to false like this:
Sorry fo the late reply.
This doesn't help the situation where you want to combine a filter on a number field and a string field like this: qs.parse({"fooString":">1", "fooNumber":">1"}); where you expect: {"fooString":{"$gt":"1"}, "fooNumber":{"$gt":1}}
Maybe it would help if you add single quotes to the syntax to aid in discriminating string fields from number fields. Like this: qs.parse({"fooString":">'1'", "fooNumber":">1"}); This may need to be escaped on the url though.
qs.parse({"foo":">1"})
results in{"foo":{"$gt":1}}
and not{"foo":{"$gt":"1"}}
where the '1' is converted to a Number field automatically. If the foo field is a string field in the database than this search query will find nothing.I haven't tested it but this will probably also be true for booleans. So you probably can't filter a text field on the word 'true'.
There should be a way to force the creation of a string filter for values that could also be a number or a boolean.
The text was updated successfully, but these errors were encountered: