You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-11Lines changed: 15 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -137,19 +137,23 @@ app.use(qs({
137
137
#### 3.5 Data
138
138
| Query | Description | Result |
139
139
| ------ | ------ | ------ |
140
-
|`?start_at=2018-11-10&end_at=2018-12-10`| Search where the user wants results between 2018-12-10 and 2018-12-12. |`{ filters: { $and: [ { created_at: { $lt: '2018-12-10T00:00:00.000Z' } }, { created_at: { $gte: '2018-11-10T00:00:00.000Z' } } ] } }`|
141
-
|`?start_at=2018-12-10`| Search where the user wants results between 2018-12-10 and the current date. In this example, the current day is: 2018-12-12. |`{ filters: { $and: [ { created_at: { $lt: '2018-12-13T00:00:00.000Z' } }, { created_at: { $gte: '2018-12-10T00:00:00.000Z' } } ] } }`|
142
-
|`?end_at=2018-12-11&period=10d`| Search where the user wants results from 10 days before 2018-12-12. |`{ filters: { $and: [ { created_at: { $lt: '2018-12-11T00:00:00.000Z' } }, { created_at: { $gte: '2018-11-30T00:00:00.000Z' } } ] } }`|
143
-
|`?period=10d`| Search where the user wants results from 10 days before the current date. In this example, the current day is: 2018-12-12. |`{ filters: { $and: [ { created_at: { $lt: '2018-12-13T00:00:00.000Z' } }, { created_at: { $gte: '2018-12-02T00:00:00.000Z' } } ] } }`|
144
-
|`?end_at=2018-12-11&period=8w`| Search where the user wants results from 8 weeks before 2018-12-12. |`{ filters: { $and: [ { created_at: { $lt: '2018-12-11T00:00:00.000Z' } }, { created_at: { $gte: '2018-10-15T00:00:00.000Z' } } ] } }`|
145
-
|`?period=8w`| Search where the user wants results from 8 weeks before the current date. In this example, the current day is: 2018-12-12. |`{ filters: { $and: [ { created_at: { $lt: '2018-12-13T00:00:00.000Z' } }, { created_at: { $gte: '2018-10-17T00:00:00.000Z' } } ] } }`|
146
-
|`?end_at=2018-12-11&period=6m`| Search where the user wants results from 6 months before 2018-12-11. |`{ filters: { $and: [ { created_at: { $lt: '2018-12-11T00:00:00.000Z' } }, { created_at: { $gte: '2018-06-10T03:00:00.000Z' } } ] } }`|
147
-
|`?period=6m`| Search where the user wants results from 6 months before the current date. In this example, the current day is: 2018-12-12. |`{ filters: { $and: [ { created_at: { $lt: '2018-12-13T00:00:00.000Z' } }, { created_at: { $gte: '2018-06-12T03:00:00.000Z' } } ] } }`|
148
-
|`?end_at=2018-12-11&period=4y`| Search where the user wants results from 4 years before 2018-12-11. |`{ filters: { $and: [ { created_at: { $lt: '2018-12-11T00:00:00.000Z' } }, { created_at: { $gte: '2014-12-10T00:00:00.000Z' } } ] } }`|
149
-
|`?period=4y`| Search where the user wants results from 4 years before the current date. In this example, the current day is: 2018-12-12. |`{ filters: { $and: [ { created_at: { $lt: '2018-12-13T00:00:00.000Z' } }, { created_at: { $gte: '2014-12-12T00:00:00.000Z' } } ] } }`|
140
+
|`?start_at=2018-11-10&end_at=2018-12-10`| Search where the user wants results between 2018-12-10 and 2018-12-12. |`{ filters: { $and: [ { created_at: { $lt: '2018-12-10T23:59:59' } }, { created_at: { $gte: '2018-11-10T00:00:00' } } ] } }`|
141
+
|`?start_at=2018-12-10`| Search where the user wants results between 2018-12-10 and the current date. In this example, the current day is: 2018-12-12. |`{ filters: { $and: [ { created_at: { $lt: '2018-12-13T23:59:59' } }, { created_at: { $gte: '2018-12-10T00:00:00' } } ] } }`|
142
+
|`?end_at=2018-12-11&period=10d`| Search where the user wants results from 10 days before 2018-12-12. |`{ filters: { $and: [ { created_at: { $lt: '2018-12-11T23:59:59' } }, { created_at: { $gte: '2018-11-30T00:00:00' } } ] } }`|
143
+
|`?period=10d`| Search where the user wants results from 10 days before the current date. In this example, the current day is: 2018-12-12. |`{ filters: { $and: [ { created_at: { $lt: '2018-12-13T23:59:59' } }, { created_at: { $gte: '2018-12-02T00:00:00' } } ] } }`|
144
+
|`?end_at=2018-12-11&period=8w`| Search where the user wants results from 8 weeks before 2018-12-12. |`{ filters: { $and: [ { created_at: { $lt: '2018-12-11T23:59:59' } }, { created_at: { $gte: '2018-10-15T00:00:00' } } ] } }`|
145
+
|`?period=8w`| Search where the user wants results from 8 weeks before the current date. In this example, the current day is: 2018-12-12. |`{ filters: { $and: [ { created_at: { $lt: '2018-12-13T23:59:59' } }, { created_at: { $gte: '2018-10-17T00:00:00' } } ] } }`|
146
+
|`?end_at=2018-12-11&period=6m`| Search where the user wants results from 6 months before 2018-12-11. |`{ filters: { $and: [ { created_at: { $lt: '2018-12-11T23:59:59' } }, { created_at: { $gte: '2018-06-10T00:00:00' } } ] } }`|
147
+
|`?period=6m`| Search where the user wants results from 6 months before the current date. In this example, the current day is: 2018-12-12. |`{ filters: { $and: [ { created_at: { $lt: '2018-12-13T23:59:59' } }, { created_at: { $gte: '2018-06-12T00:00:00' } } ] } }`|
148
+
|`?end_at=2018-12-11&period=4y`| Search where the user wants results from 4 years before 2018-12-11. |`{ filters: { $and: [ { created_at: { $lt: '2018-12-11T23:59:59' } }, { created_at: { $gte: '2014-12-10T00:00:00' } } ] } }`|
149
+
|`?period=4y`| Search where the user wants results from 4 years before the current date. In this example, the current day is: 2018-12-12. |`{ filters: { $and: [ { created_at: { $lt: '2018-12-13T23:59:59' } }, { created_at: { $gte: '2014-12-12T00:00:00' } } ] } }`|
150
150
151
151
#### 3.6 Search
152
-
// TODO
152
+
| Query | Description | Result |
153
+
| ------ | ------ | ------ |
154
+
|`?name=elvis*`| Search where the user want results that the name starts with value 'elvis'. |`{ filters: { name: { '$options': 'i', '$regex': '^lucas' } } `|
155
+
|`?name=*elvis`| Search where the user want results that the name ends with the value 'elvis'. |`{ filters: { name: { '$options': 'i', '$regex': 'lucas&' } } `|
156
+
|`?name=*elvis*`| Search where the user wants results for name that contains the value 'elvis' in any position. |`{ filters: { name: { '$options': 'i', '$regex': 'lucas' } } `|
153
157
154
158
**NOTES** :
155
159
* Default values are used only when they are not passed in the query string. For example, if you set the default value `?sort=-age`_(age in descending order)_ and your client makes a request with `?sort=name`_(name in ascending order)_, you will get in req.query the value `{ sort: { name: 'asc' } }`, since the values passed by the client will always have preference.
0 commit comments