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!
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
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: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