@@ -28,17 +28,23 @@ public extension Query {
28
28
29
29
/**
30
30
Query plan information for finding objects *asynchronously*.
31
+ - parameter isUsingMongoDB: Set to **true** if your Parse Server uses MongoDB. Defaults to **false**.
31
32
- parameter options: A set of header options sent to the server. Defaults to an empty set.
32
33
- note: An explain query will have many different underlying types. Since Swift is a strongly
33
34
typed language, a developer should specify the type expected to be decoded which will be
34
35
different for MongoDB and PostgreSQL. One way around this is to use a type-erased wrapper
35
36
such as the [AnyCodable](https://github.com/Flight-School/AnyCodable) package.
36
37
- returns: An array of ParseObjects.
37
38
- throws: An error of type `ParseError`.
39
+ - warning: MongoDB's **explain** does not conform to the traditional Parse Server response, so the
40
+ `isUsingMongoDB` flag needs to be set for MongoDB users. See more
41
+ [here](https://github.com/parse-community/parse-server/pull/7440).
38
42
*/
39
- func findExplain< U: Decodable > ( options: API . Options = [ ] ) async throws -> [ U ] {
43
+ func findExplain< U: Decodable > ( isUsingMongoDB: Bool = false ,
44
+ options: API . Options = [ ] ) async throws -> [ U ] {
40
45
try await withCheckedThrowingContinuation { continuation in
41
- self . findExplain ( options: options,
46
+ self . findExplain ( isUsingMongoDB: isUsingMongoDB,
47
+ options: options,
42
48
completion: continuation. resume)
43
49
}
44
50
}
@@ -80,13 +86,19 @@ public extension Query {
80
86
typed language, a developer should specify the type expected to be decoded which will be
81
87
different for MongoDB and PostgreSQL. One way around this is to use a type-erased wrapper
82
88
such as the [AnyCodable](https://github.com/Flight-School/AnyCodable) package.
89
+ - parameter isUsingMongoDB: Set to **true** if your Parse Server uses MongoDB. Defaults to **false**.
83
90
- parameter options: A set of header options sent to the server. Defaults to an empty set.
84
91
- returns: An array of ParseObjects.
85
92
- throws: An error of type `ParseError`.
93
+ - warning: MongoDB's **explain** does not conform to the traditional Parse Server response, so the
94
+ `isUsingMongoDB` flag needs to be set for MongoDB users. See more
95
+ [here](https://github.com/parse-community/parse-server/pull/7440).
86
96
*/
87
- func firstExplain< U: Decodable > ( options: API . Options = [ ] ) async throws -> U {
97
+ func firstExplain< U: Decodable > ( isUsingMongoDB: Bool = false ,
98
+ options: API . Options = [ ] ) async throws -> U {
88
99
try await withCheckedThrowingContinuation { continuation in
89
- self . firstExplain ( options: options,
100
+ self . firstExplain ( isUsingMongoDB: isUsingMongoDB,
101
+ options: options,
90
102
completion: continuation. resume)
91
103
}
92
104
}
@@ -110,14 +122,19 @@ public extension Query {
110
122
typed language, a developer should specify the type expected to be decoded which will be
111
123
different for MongoDB and PostgreSQL. One way around this is to use a type-erased wrapper
112
124
such as the [AnyCodable](https://github.com/Flight-School/AnyCodable) package.
113
- - parameter explain: Used to toggle the information on the query plan .
125
+ - parameter isUsingMongoDB: Set to **true** if your Parse Server uses MongoDB. Defaults to **false** .
114
126
- parameter options: A set of header options sent to the server. Defaults to an empty set.
115
127
- returns: An array of ParseObjects.
116
128
- throws: An error of type `ParseError`.
129
+ - warning: MongoDB's **explain** does not conform to the traditional Parse Server response, so the
130
+ `isUsingMongoDB` flag needs to be set for MongoDB users. See more
131
+ [here](https://github.com/parse-community/parse-server/pull/7440).
117
132
*/
118
- func countExplain< U: Decodable > ( options: API . Options = [ ] ) async throws -> [ U ] {
133
+ func countExplain< U: Decodable > ( isUsingMongoDB: Bool = false ,
134
+ options: API . Options = [ ] ) async throws -> [ U ] {
119
135
try await withCheckedThrowingContinuation { continuation in
120
- self . countExplain ( options: options,
136
+ self . countExplain ( isUsingMongoDB: isUsingMongoDB,
137
+ options: options,
121
138
completion: continuation. resume)
122
139
}
123
140
}
@@ -142,14 +159,19 @@ public extension Query {
142
159
typed language, a developer should specify the type expected to be decoded which will be
143
160
different for mongoDB and PostgreSQL. One way around this is to use a type-erased wrapper
144
161
such as the [AnyCodable](https://github.com/Flight-School/AnyCodable) package.
145
- - parameter explain: Used to toggle the information on the query plan .
162
+ - parameter isUsingMongoDB: Set to **true** if your Parse Server uses MongoDB. Defaults to **false** .
146
163
- parameter options: A set of header options sent to the server. Defaults to an empty set.
147
164
- returns: An array of ParseObjects.
148
165
- throws: An error of type `ParseError`.
166
+ - warning: MongoDB's **explain** does not conform to the traditional Parse Server response, so the
167
+ `isUsingMongoDB` flag needs to be set for MongoDB users. See more
168
+ [here](https://github.com/parse-community/parse-server/pull/7440).
149
169
*/
150
- func withCountExplain< U: Decodable > ( options: API . Options = [ ] ) async throws -> [ U ] {
170
+ func withCountExplain< U: Decodable > ( isUsingMongoDB: Bool = false ,
171
+ options: API . Options = [ ] ) async throws -> [ U ] {
151
172
try await withCheckedThrowingContinuation { continuation in
152
- self . withCountExplain ( options: options,
173
+ self . withCountExplain ( isUsingMongoDB: isUsingMongoDB,
174
+ options: options,
153
175
completion: continuation. resume)
154
176
}
155
177
}
@@ -179,16 +201,22 @@ public extension Query {
179
201
different for MongoDB and PostgreSQL. One way around this is to use a type-erased wrapper
180
202
such as the [AnyCodable](https://github.com/Flight-School/AnyCodable) package.
181
203
- parameter pipeline: A pipeline of stages to process query.
204
+ - parameter isUsingMongoDB: Set to **true** if your Parse Server uses MongoDB. Defaults to **false**.
182
205
- parameter options: A set of header options sent to the server. Defaults to an empty set.
183
206
- returns: An array of ParseObjects.
184
207
- throws: An error of type `ParseError`.
208
+ - warning: MongoDB's **explain** does not conform to the traditional Parse Server response, so the
209
+ `isUsingMongoDB` flag needs to be set for MongoDB users. See more
210
+ [here](https://github.com/parse-community/parse-server/pull/7440).
185
211
*/
186
212
func aggregateExplain< U: Decodable > ( _ pipeline: [ [ String : Encodable ] ] ,
213
+ isUsingMongoDB: Bool = false ,
187
214
options: API . Options = [ ] ) async throws -> [ U ] {
188
215
try await withCheckedThrowingContinuation { continuation in
189
216
self . aggregateExplain ( pipeline,
190
- options: options,
191
- completion: continuation. resume)
217
+ isUsingMongoDB: isUsingMongoDB,
218
+ options: options,
219
+ completion: continuation. resume)
192
220
}
193
221
}
194
222
@@ -217,14 +245,20 @@ public extension Query {
217
245
different for MongoDB and PostgreSQL. One way around this is to use a type-erased wrapper
218
246
such as the [AnyCodable](https://github.com/Flight-School/AnyCodable) package.
219
247
- parameter key: A field to find distinct values.
248
+ - parameter isUsingMongoDB: Set to **true** if your Parse Server uses MongoDB. Defaults to **false**.
220
249
- parameter options: A set of header options sent to the server. Defaults to an empty set.
221
250
- returns: An array of ParseObjects.
222
251
- throws: An error of type `ParseError`.
252
+ - warning: MongoDB's **explain** does not conform to the traditional Parse Server response, so the
253
+ `isUsingMongoDB` flag needs to be set for MongoDB users. See more
254
+ [here](https://github.com/parse-community/parse-server/pull/7440).
223
255
*/
224
256
func distinctExplain< U: Decodable > ( _ key: String ,
257
+ isUsingMongoDB: Bool = false ,
225
258
options: API . Options = [ ] ) async throws -> [ U ] {
226
259
try await withCheckedThrowingContinuation { continuation in
227
260
self . distinctExplain ( key,
261
+ isUsingMongoDB: isUsingMongoDB,
228
262
options: options,
229
263
completion: continuation. resume)
230
264
}
0 commit comments