Skip to content

Commit 74e7139

Browse files
committed
fix(dart): improve ParseAggregate pipeline encoding and remove debug print
- Send each pipeline stage as individual query parameter with JSON-encoded value instead of bundling into a single 'pipeline' string, improving compatibility with Parse Server's getPipeline() format - Remove debug print() statement that leaked pipeline URL to console - Use handleResponse for consistent response handling with other ParseObject subclasses
1 parent 18ea019 commit 74e7139

2 files changed

Lines changed: 24 additions & 13 deletions

File tree

packages/dart/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## [8.0.1] (2026-03-12)
2+
3+
### Bug Fixes
4+
5+
* Fix `ParseAggregate.execute()` pipeline encoding: send each stage as an individual query parameter with JSON-encoded value instead of bundling into a single `pipeline` string, improving compatibility with Parse Server's `getPipeline()` format
6+
* Remove debug `print()` statement in `ParseAggregate.execute()` that leaked the full pipeline URL to console
7+
* Use `handleResponse` in `ParseAggregate.execute()` for consistent response handling with other `ParseObject` subclasses
8+
19
## [8.0.0](https://github.com/parse-community/Parse-SDK-Flutter/compare/dart-7.0.1...dart-8.0.0) (2024-12-20)
210

311
### BREAKING CHANGES

packages/dart/lib/src/objects/parse_aggregate.dart

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,33 @@ class ParseAggregate extends ParseObject {
2222
@override
2323
late String _path;
2424

25-
Future<ParseResponse> execute(Map<String, dynamic> pipeline, {Map<String, String>? headers}) async {
25+
Future<ParseResponse> execute(
26+
Map<String, dynamic> pipeline, {
27+
Map<String, String>? headers,
28+
}) async {
2629
final String uri = '${ParseCoreData().serverUrl}$_path';
2730

28-
Map<String, String> parameters = {};
29-
3031
if (pipeline.isEmpty) {
3132
throw ArgumentError(
3233
'pipeline must not be empty. Please add pipeline operations to aggregate data. '
3334
'Example: {"\$group": {"_id": "\$userId", "totalScore": {"\$sum": "\$score"}}}',
3435
);
35-
} else {
36-
parameters.addAll({
37-
'pipeline': jsonEncode(pipeline.entries.map((e) => {e.key: e.value}).toList())
38-
});
39-
_setObjectData(pipeline);
4036
}
4137

38+
// Each pipeline stage is sent as an individual query parameter
39+
// with its JSON-encoded value, matching Parse Server's getPipeline() format
40+
final Map<String, String> parameters = {
41+
for (final entry in pipeline.entries)
42+
entry.key: jsonEncode(entry.value),
43+
};
44+
4245
try {
43-
print(Uri.parse(uri).replace(queryParameters: parameters).toString());
4446
final ParseNetworkResponse result = await _client.get(
45-
Uri.parse(uri).replace(queryParameters: parameters).toString(),
46-
options: ParseNetworkOptions(headers: headers)
47-
);
48-
return ParseResponse.fromParseNetworkResponse(result);
47+
Uri.parse(uri).replace(queryParameters: parameters).toString(),
48+
options: ParseNetworkOptions(headers: headers),
49+
);
50+
return handleResponse<ParseAggregate>(
51+
this, result, ParseApiRQ.execute, _debug, parseClassName);
4952
} on Exception catch (e) {
5053
return handleException(e, ParseApiRQ.execute, _debug, parseClassName);
5154
}

0 commit comments

Comments
 (0)