@@ -17,10 +17,35 @@ useful when building an API and accepting various user specificed queries.
1717 * ` $lt `
1818 * ` $regex `
1919 * ` $exists `
20+
21+ | operation | query string | query object |
22+ | -----------| ---------------| --------------|
23+ | equal | ` ?foo=bar ` | ` { foo: "bar" } ` |
24+ | unequal | ` ?foo=!bar ` | ` { foo: { $ne: "bar" }} ` |
25+ | exists | ` ?foo= ` | ` { foo: { $exists: true }} ` |
26+ | not exists | ` ?foo=! ` | ` { foo: { $exists: false }} ` |
27+ | greater than | ` ?foo=>10 ` | ` { foo: { $gt: 10 }} ` |
28+ | less than | ` ?foo=<10 ` | ` { foo: { $lt: 10 }} ` |
29+ | starts with | ` ?foo=^bar ` | ` { foo: { $regex: "^foo", $options: "i" }} ` |
30+ | ends with | ` ?foo=$bar ` | ` { foo: { $regex: "foo$", $options: "i" }} ` |
31+ | contains | ` ?foo=~bar ` | ` { foo: { $regex: "foo", $options: "i" }} ` |
32+
2033* Geospatial operators
21- * ` $geoWithin `
22- * ` $near `
34+ * ` $geoWithin ` (polygon)
35+ * ` $near ` (point)
36+
37+ | operation | query string | query object |
38+ | -----------| ---------------| --------------|
39+ | bbox | ` ?bbox=~0,1,2,3 ` | ` { geojson: { $geoWithin: { $geometry: { … } } } } ` |
40+ | near | ` ?near=~0,1 ` | ` { geojson: { $near: { $geometry: { … } } } } ` |
41+
2342* Custom query functions
43+ * ` after ` (date)
44+
45+ | operation | query string | query object |
46+ | -----------| ---------------| --------------|
47+ | after | ` ?after=2014-01-01 ` | ` { endret: { $gte: "2014-01-01T00:00:00.000Z" } } ` |
48+ | after | ` ?after=1388534400 ` | ` { endret: { $gte: "2014-01-01T00:00:00.000Z" } } ` |
2449
2550## Install
2651
@@ -44,8 +69,8 @@ var MongoQS = require('mongo-querystring');
4469
4570#### Bult in custom queries
4671
47- * ` bbox ` - bounding box query
48- * ` near ` - proximity query
72+ * ` bbox ` - bounding box geostatial query
73+ * ` near ` - proximity geostatial query
4974* ` after ` - modified since query
5075
5176#### Define custom queries
@@ -81,4 +106,3 @@ mongo.collection('mycol').find(query, field).toArray(function(err, documents) {
81106```
82107
83108## [ MIT Licensed] ( https://raw.githubusercontent.com/Turistforeningen/node-mongo-querystring/master/LICENSE )
84-
0 commit comments