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!
Hi, I've been playing a little with your lib but I found no way of escaping operators that occur in the first part of the values. For example, what would be the querystring for the following output:
{"foo":"!baz"}.
I've tried:
?foo=!baz => {"foo":{"$ne":"baz"}} (duh)
?foo=%21baz => {"foo":{"$ne":"baz"}} (ExpressJS resolves %21 before your lib sees it)
?foo=%27!baz%27 => {"foo":"'!baz'"} same problem, resolved by ExpressJS
But even without ExpressJS in between % escaping it doesn't seem to work.
P.S. Like another poster I would also like to combine the whole expression into one q=... parameter, otherwise it would cause conflicts with other meaningful parameters like page, limit etc.
Hi, I've been playing a little with your lib but I found no way of escaping operators that occur in the first part of the values. For example, what would be the querystring for the following output: {"foo":"!baz"}.
I've tried: ?foo=!baz => {"foo":{"$ne":"baz"}} (duh) ?foo=%21baz => {"foo":{"$ne":"baz"}} (ExpressJS resolves %21 before your lib sees it) ?foo=%27!baz%27 => {"foo":"'!baz'"} same problem, resolved by ExpressJS
But even without ExpressJS in between % escaping it doesn't seem to work.
P.S. Like another poster I would also like to combine the whole expression into one q=... parameter, otherwise it would cause conflicts with other meaningful parameters like page, limit etc.