@go-mailer/jarvis 3.2.7 → 3.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/query.js +10 -17
- package/package.json +1 -1
package/lib/query.js
CHANGED
|
@@ -123,14 +123,19 @@ const buildWildcardOptions = (key_list, value) => {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
const determinePagination = (page = 0, population
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
const determinePagination = (page = 0, population) => {
|
|
127
|
+
const pagination = {
|
|
128
|
+
skip: population ? skip * population : skip
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (population) {
|
|
132
|
+
pagination.limit = Number(population)
|
|
130
133
|
}
|
|
134
|
+
|
|
135
|
+
return pagination
|
|
131
136
|
}
|
|
132
137
|
|
|
133
|
-
const generateGroupPipeline = ({ group_by, seek_conditions, sort_condition,
|
|
138
|
+
const generateGroupPipeline = ({ group_by, seek_conditions, sort_condition, fields_to_return, count }) => {
|
|
134
139
|
if (!group_by || typeof group_by !== 'string') return null
|
|
135
140
|
|
|
136
141
|
const pipeline = []
|
|
@@ -140,18 +145,6 @@ const generateGroupPipeline = ({ group_by, seek_conditions, sort_condition, skip
|
|
|
140
145
|
$match: { ...seek_conditions }
|
|
141
146
|
})
|
|
142
147
|
|
|
143
|
-
if (skip) {
|
|
144
|
-
pipeline.push({
|
|
145
|
-
$skip: { skip }
|
|
146
|
-
})
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
if (limit) {
|
|
150
|
-
pipeline.push({
|
|
151
|
-
$limit: { limit: Math.floor(limit) }
|
|
152
|
-
})
|
|
153
|
-
}
|
|
154
|
-
|
|
155
148
|
if (sort_condition){
|
|
156
149
|
const sort_options = sort_condition.split(' ').reduce((sac, condition) => {
|
|
157
150
|
let key = condition
|