@@ -463,7 +463,7 @@ You can group by a field.
463
463
``` javascript
464
464
// score is the field. $ before score lets the database know this is a field
465
465
var pipeline = [
466
- group: { objectId: ' $score' }
466
+ { group: { objectId: ' $score' } }
467
467
];
468
468
var query = new Parse.Query (" User" );
469
469
query .aggregate (pipeline)
@@ -480,7 +480,7 @@ You can apply collective calculations like $sum, $avg, $max, $min.
480
480
``` javascript
481
481
// total will be a newly created field to hold the sum of score field
482
482
var pipeline = [
483
- group: { objectId: null , total: { $sum: ' $score' } }
483
+ { group: { objectId: null , total: { $sum: ' $score' } } }
484
484
];
485
485
var query = new Parse.Query (" User" );
486
486
query .aggregate (pipeline)
@@ -496,7 +496,7 @@ Project pipeline is similar to `keys` or `select`, add or remove existing fields
496
496
497
497
``` javascript
498
498
var pipeline = [
499
- project: { name: 1 }
499
+ { project: { name: 1 } }
500
500
];
501
501
var query = new Parse.Query (" User" );
502
502
query .aggregate (pipeline)
@@ -528,7 +528,7 @@ You can match by comparison.
528
528
529
529
``` javascript
530
530
var pipeline = [
531
- match: { score: { $gt: 15 } }
531
+ { match: { score: { $gt: 15 } } }
532
532
];
533
533
var query = new Parse.Query (" User" );
534
534
query .aggregate (pipeline)
@@ -582,4 +582,4 @@ query.readPreference(
582
582
' SECONDARY_PREFERRED' ,
583
583
' NEAREST'
584
584
);
585
- ```
585
+ ```
0 commit comments