Turistforeningen / node-mongo-querystring

Query builder for accepting URL query parameters into your MongoDB queries. Safe and feature rich. Supports most of MongoDB's query operators such as $eq, $gt, $lt, $ne, $in, $nin, $exists, $regex, geospatial queries such as bbox and near, as well as your own custom query business logic!
MIT License
100 stars 31 forks source link

Using $gt and $lt together #20

Closed leobudima closed 8 years ago

leobudima commented 8 years ago

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!

Starefossen commented 8 years ago

You suggestion has been implemented in mongo-querystring@3.0.0. Check it out and thanks for using this library :smile:

leobudima commented 8 years ago

Thanks so much, made my day! :) All the best!