@@ -444,26 +444,24 @@ The following example is a pipeline similar to `distinct` grouping by name field
444444
445445``` javascript
446446const pipelineObject = {
447- group: { objectId : ' $name' }
447+ $ group: { _id : ' $name' }
448448 };
449449
450450const pipelineArray = [
451- { group: { objectId : ' $name' } }
451+ { $ group: { _id : ' $name' } }
452452];
453453```
454454
455455For a list of available operators please refer to [ Mongo Aggregate Documentation] ( https://docs.mongodb.com/v3.2/reference/operator/aggregation/ ) .
456456
457- * Note: Most operations in Mongo Aggregate Documentation will work with Parse Server, but ` _id ` doesn't exist. Please replace with ` objectId ` .
458-
459457Group pipeline is similar to ` distinct ` .
460458
461459You can group by a field.
462460
463461``` javascript
464462// score is the field. $ before score lets the database know this is a field
465463const pipeline = [
466- { group: { objectId : ' $score' } }
464+ { $ group: { _id : ' $score' } }
467465];
468466const query = new Parse.Query (" User" );
469467query .aggregate (pipeline)
@@ -480,7 +478,7 @@ You can apply collective calculations like $sum, $avg, $max, $min.
480478``` javascript
481479// total will be a newly created field to hold the sum of score field
482480const pipeline = [
483- { group: { objectId : null , total: { $sum: ' $score' } } }
481+ { $ group: { _id : null , total: { $sum: ' $score' } } }
484482];
485483const query = new Parse.Query (" User" );
486484query .aggregate (pipeline)
@@ -496,7 +494,7 @@ Project pipeline is similar to `keys` or `select`, add or remove existing fields
496494
497495``` javascript
498496const pipeline = [
499- { project: { name: 1 } }
497+ { $ project: { name: 1 } }
500498];
501499const query = new Parse.Query (" User" );
502500query .aggregate (pipeline)
@@ -512,7 +510,7 @@ Match pipeline is similar to `equalTo`.
512510
513511``` javascript
514512const pipeline = [
515- { match: { name: ' BBQ' } }
513+ { $ match: { name: ' BBQ' } }
516514];
517515const query = new Parse.Query (" User" );
518516query .aggregate (pipeline)
@@ -528,7 +526,7 @@ You can match by comparison.
528526
529527``` javascript
530528const pipeline = [
531- { match: { score: { $gt: 15 } } }
529+ { $ match: { score: { $gt: 15 } } }
532530];
533531const query = new Parse.Query (" User" );
534532query .aggregate (pipeline)
0 commit comments