Skip to content

Commit a1c8ab0

Browse files
0xthierrydplewis
authored andcommitted
docs: fixed examples for pipeline in aggregation (#661)
1 parent 562e916 commit a1c8ab0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

_includes/js/queries.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ You can group by a field.
463463
```javascript
464464
// score is the field. $ before score lets the database know this is a field
465465
var pipeline = [
466-
group: { objectId: '$score' }
466+
{ group: { objectId: '$score' } }
467467
];
468468
var query = new Parse.Query("User");
469469
query.aggregate(pipeline)
@@ -480,7 +480,7 @@ You can apply collective calculations like $sum, $avg, $max, $min.
480480
```javascript
481481
// total will be a newly created field to hold the sum of score field
482482
var pipeline = [
483-
group: { objectId: null, total: { $sum: '$score' } }
483+
{ group: { objectId: null, total: { $sum: '$score' } } }
484484
];
485485
var query = new Parse.Query("User");
486486
query.aggregate(pipeline)
@@ -496,7 +496,7 @@ Project pipeline is similar to `keys` or `select`, add or remove existing fields
496496

497497
```javascript
498498
var pipeline = [
499-
project: { name: 1 }
499+
{ project: { name: 1 } }
500500
];
501501
var query = new Parse.Query("User");
502502
query.aggregate(pipeline)
@@ -528,7 +528,7 @@ You can match by comparison.
528528

529529
```javascript
530530
var pipeline = [
531-
match: { score: { $gt: 15 } }
531+
{ match: { score: { $gt: 15 } } }
532532
];
533533
var query = new Parse.Query("User");
534534
query.aggregate(pipeline)
@@ -582,4 +582,4 @@ query.readPreference(
582582
'SECONDARY_PREFERRED',
583583
'NEAREST'
584584
);
585-
```
585+
```

0 commit comments

Comments
 (0)