-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using $gt and $lt together #20
Labels
Comments
Starefossen
pushed a commit
that referenced
this issue
Apr 7, 2016
Refacotr operator parsing logic into a separate function which is reused for arrays and normal key value parsing. This also allows multiple entries of operators in adition to $in and $nin operators inside arrays. The query `?count=>10&count<100` will evaluate to the following: ``` { "count": { "$gt": 10, "$lt": 100, } } ``` BREAKING CHANGE: the new parser will not discriminate agains having both $in and $nin values for the same key - which is redundant - but still a valid query. Close #20
Starefossen
pushed a commit
that referenced
this issue
Apr 7, 2016
Refacotr operator parsing logic into a separate function which is reused for arrays and normal key value parsing. This also allows multiple entries of operators in adition to $in and $nin operators inside arrays. The query `?count=>10&count<100` will evaluate to the following: ``` { "count": { "$gt": 10, "$lt": 100, } } ``` BREAKING CHANGE: the new parser will not discriminate agains having both $in and $nin values for the same key - which is redundant - but still a valid query. Close #20 Signed-off-by: Hans Kristian Flaatten <hans.kristian.flaatten@dnt.no>
Starefossen
pushed a commit
that referenced
this issue
Apr 7, 2016
Refactor operator parsing logic into a separate function which is reused for arrays and normal key value parsing. This also allows multiple entries of operators in addition to `$in` and `$nin` operators inside arrays. The query `?count=>10&count<100` will evaluate to the following: ``` { "count": { "$gt": 10, "$lt": 100, } } ``` BREAKING CHANGE: the new parser will not discriminate agains having both `$in` and `$nin` values for the same key - which is redundant - but still a valid query. Close #20 Signed-off-by: Hans Kristian Flaatten <hans.kristian.flaatten@dnt.no>
You suggestion has been implemented in |
Thanks so much, made my day! :) All the best! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
thanks a lot for your effort on this library - extremely useful!
I'm having a problem, though, when using it to parse query params sent to a hapijs server and trying to specify a range of values for a parameter, such as:
url?count=>10&count=<100
parsed query comes out as:
count: { '$in': [ '>10', '<100' ] } }
The expected result would, naturally, be:
count: {$gt: 10, $lt: 100}
Do you have any suggestions on how to work around this, or is this something you would consider supporting?
Thanks!
The text was updated successfully, but these errors were encountered: