@@ -29,17 +29,14 @@ public extension Query {
2929 }
3030
3131 /**
32- Finds objects *asynchronously* and publishes when complete.
33- - parameter explain: Used to toggle the information on the query plan.
32+ Query plan information for finding objects *asynchronously* and publishes when complete.
3433 - parameter options: A set of header options sent to the server. Defaults to an empty set.
3534 - returns: A publisher that eventually produces a single value and then finishes or fails.
3635 */
37- func findPublisher< U: Decodable > ( explain: Bool ,
38- options: API . Options = [ ] ) -> Future < [ U ] , ParseError > {
36+ func findExplainPublisher< U: Decodable > ( options: API . Options = [ ] ) -> Future < [ U ] , ParseError > {
3937 Future { promise in
40- self . find ( explain: explain,
41- options: options,
42- completion: promise)
38+ self . findExplain ( options: options,
39+ completion: promise)
4340 }
4441 }
4542
@@ -74,17 +71,14 @@ public extension Query {
7471 }
7572
7673 /**
77- Gets an object *asynchronously* and publishes when complete.
78- - parameter explain: Used to toggle the information on the query plan.
74+ Query plan information for getting an object *asynchronously* and publishes when complete.
7975 - parameter options: A set of header options sent to the server. Defaults to an empty set.
8076 - returns: A publisher that eventually produces a single value and then finishes or fails.
8177 */
82- func firstPublisher< U: Decodable > ( explain: Bool ,
83- options: API . Options = [ ] ) -> Future < U , ParseError > {
78+ func firstExplainPublisher< U: Decodable > ( options: API . Options = [ ] ) -> Future < U , ParseError > {
8479 Future { promise in
85- self . first ( explain: explain,
86- options: options,
87- completion: promise)
80+ self . firstExplain ( options: options,
81+ completion: promise)
8882 }
8983 }
9084
@@ -101,35 +95,81 @@ public extension Query {
10195 }
10296
10397 /**
104- Count objects *asynchronously* and publishes when complete.
98+ Query plan information for counting objects *asynchronously* and publishes when complete.
10599 - parameter explain: Used to toggle the information on the query plan.
106100 - parameter options: A set of header options sent to the server. Defaults to an empty set.
107101 - returns: A publisher that eventually produces a single value and then finishes or fails.
108102 */
109- func countPublisher< U: Decodable > ( explain: Bool ,
110- options: API . Options = [ ] ) -> Future < U , ParseError > {
103+ func countExplainPublisher< U: Decodable > ( options: API . Options = [ ] ) -> Future < U , ParseError > {
111104 Future { promise in
112- self . count ( explain: explain,
113- options: options,
114- completion: promise)
105+ self . countExplain ( options: options,
106+ completion: promise)
115107 }
116108 }
117109
118110 /**
119111 Executes an aggregate query *asynchronously* and publishes when complete.
120- - requires: `.useMasterKey` has to be available and passed as one of the set of `options` .
112+ - requires: `.useMasterKey` has to be available.
121113 - parameter pipeline: A pipeline of stages to process query.
122114 - parameter options: A set of header options sent to the server. Defaults to an empty set.
123115 - returns: A publisher that eventually produces a single value and then finishes or fails.
124116 */
125- func aggregatePublisher( _ pipeline: AggregateType ,
117+ func aggregatePublisher( _ pipeline: [ [ String : Encodable ] ] ,
126118 options: API . Options = [ ] ) -> Future < [ ResultType ] , ParseError > {
127119 Future { promise in
128120 self . aggregate ( pipeline,
129121 options: options,
130122 completion: promise)
131123 }
132124 }
125+
126+ /**
127+ Query plan information for executing an aggregate query *asynchronously* and publishes when complete.
128+ - requires: `.useMasterKey` has to be available.
129+ - parameter pipeline: A pipeline of stages to process query.
130+ - parameter options: A set of header options sent to the server. Defaults to an empty set.
131+ - returns: A publisher that eventually produces a single value and then finishes or fails.
132+ */
133+ func aggregateExplainPublisher< U: Decodable > ( _ pipeline: [ [ String : Encodable ] ] ,
134+ options: API . Options = [ ] ) -> Future < [ U ] , ParseError > {
135+ Future { promise in
136+ self . aggregateExplain ( pipeline,
137+ options: options,
138+ completion: promise)
139+ }
140+ }
141+
142+ /**
143+ Executes a distinct query *asynchronously* and publishes unique values when complete.
144+ - requires: `.useMasterKey` has to be available.
145+ - parameter key: A field to find distinct values.
146+ - parameter options: A set of header options sent to the server. Defaults to an empty set.
147+ - returns: A publisher that eventually produces a single value and then finishes or fails.
148+ */
149+ func distinctPublisher( _ key: String ,
150+ options: API . Options = [ ] ) -> Future < [ ResultType ] , ParseError > {
151+ Future { promise in
152+ self . distinct ( key,
153+ options: options,
154+ completion: promise)
155+ }
156+ }
157+
158+ /**
159+ Query plan information for executing a distinct query *asynchronously* and publishes unique values when complete.
160+ - requires: `.useMasterKey` has to be available.
161+ - parameter key: A field to find distinct values.
162+ - parameter options: A set of header options sent to the server. Defaults to an empty set.
163+ - returns: A publisher that eventually produces a single value and then finishes or fails.
164+ */
165+ func distinctExplainPublisher< U: Decodable > ( _ key: String ,
166+ options: API . Options = [ ] ) -> Future < [ U ] , ParseError > {
167+ Future { promise in
168+ self . distinctExplain ( key,
169+ options: options,
170+ completion: promise)
171+ }
172+ }
133173}
134174
135175#endif
0 commit comments