@@ -28,17 +28,23 @@ public extension Query {
2828
2929 /**
3030 Query plan information for finding objects *asynchronously*.
31+ - parameter isUsingMongoDB: Set to **true** if your Parse Server uses MongoDB. Defaults to **false**.
3132 - parameter options: A set of header options sent to the server. Defaults to an empty set.
3233 - note: An explain query will have many different underlying types. Since Swift is a strongly
3334 typed language, a developer should specify the type expected to be decoded which will be
3435 different for MongoDB and PostgreSQL. One way around this is to use a type-erased wrapper
3536 such as the [AnyCodable](https://github.com/Flight-School/AnyCodable) package.
3637 - returns: An array of ParseObjects.
3738 - 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).
3842 */
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 ] {
4045 try await withCheckedThrowingContinuation { continuation in
41- self . findExplain ( options: options,
46+ self . findExplain ( isUsingMongoDB: isUsingMongoDB,
47+ options: options,
4248 completion: continuation. resume)
4349 }
4450 }
@@ -80,13 +86,19 @@ public extension Query {
8086 typed language, a developer should specify the type expected to be decoded which will be
8187 different for MongoDB and PostgreSQL. One way around this is to use a type-erased wrapper
8288 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**.
8390 - parameter options: A set of header options sent to the server. Defaults to an empty set.
8491 - returns: An array of ParseObjects.
8592 - 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).
8696 */
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 {
8899 try await withCheckedThrowingContinuation { continuation in
89- self . firstExplain ( options: options,
100+ self . firstExplain ( isUsingMongoDB: isUsingMongoDB,
101+ options: options,
90102 completion: continuation. resume)
91103 }
92104 }
@@ -110,14 +122,19 @@ public extension Query {
110122 typed language, a developer should specify the type expected to be decoded which will be
111123 different for MongoDB and PostgreSQL. One way around this is to use a type-erased wrapper
112124 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** .
114126 - parameter options: A set of header options sent to the server. Defaults to an empty set.
115127 - returns: An array of ParseObjects.
116128 - 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).
117132 */
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 ] {
119135 try await withCheckedThrowingContinuation { continuation in
120- self . countExplain ( options: options,
136+ self . countExplain ( isUsingMongoDB: isUsingMongoDB,
137+ options: options,
121138 completion: continuation. resume)
122139 }
123140 }
@@ -142,14 +159,19 @@ public extension Query {
142159 typed language, a developer should specify the type expected to be decoded which will be
143160 different for mongoDB and PostgreSQL. One way around this is to use a type-erased wrapper
144161 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** .
146163 - parameter options: A set of header options sent to the server. Defaults to an empty set.
147164 - returns: An array of ParseObjects.
148165 - 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).
149169 */
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 ] {
151172 try await withCheckedThrowingContinuation { continuation in
152- self . withCountExplain ( options: options,
173+ self . withCountExplain ( isUsingMongoDB: isUsingMongoDB,
174+ options: options,
153175 completion: continuation. resume)
154176 }
155177 }
@@ -179,16 +201,22 @@ public extension Query {
179201 different for MongoDB and PostgreSQL. One way around this is to use a type-erased wrapper
180202 such as the [AnyCodable](https://github.com/Flight-School/AnyCodable) package.
181203 - parameter pipeline: A pipeline of stages to process query.
204+ - parameter isUsingMongoDB: Set to **true** if your Parse Server uses MongoDB. Defaults to **false**.
182205 - parameter options: A set of header options sent to the server. Defaults to an empty set.
183206 - returns: An array of ParseObjects.
184207 - 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).
185211 */
186212 func aggregateExplain< U: Decodable > ( _ pipeline: [ [ String : Encodable ] ] ,
213+ isUsingMongoDB: Bool = false ,
187214 options: API . Options = [ ] ) async throws -> [ U ] {
188215 try await withCheckedThrowingContinuation { continuation in
189216 self . aggregateExplain ( pipeline,
190- options: options,
191- completion: continuation. resume)
217+ isUsingMongoDB: isUsingMongoDB,
218+ options: options,
219+ completion: continuation. resume)
192220 }
193221 }
194222
@@ -217,14 +245,20 @@ public extension Query {
217245 different for MongoDB and PostgreSQL. One way around this is to use a type-erased wrapper
218246 such as the [AnyCodable](https://github.com/Flight-School/AnyCodable) package.
219247 - parameter key: A field to find distinct values.
248+ - parameter isUsingMongoDB: Set to **true** if your Parse Server uses MongoDB. Defaults to **false**.
220249 - parameter options: A set of header options sent to the server. Defaults to an empty set.
221250 - returns: An array of ParseObjects.
222251 - 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).
223255 */
224256 func distinctExplain< U: Decodable > ( _ key: String ,
257+ isUsingMongoDB: Bool = false ,
225258 options: API . Options = [ ] ) async throws -> [ U ] {
226259 try await withCheckedThrowingContinuation { continuation in
227260 self . distinctExplain ( key,
261+ isUsingMongoDB: isUsingMongoDB,
228262 options: options,
229263 completion: continuation. resume)
230264 }
0 commit comments