Skip to content

Commit

Permalink
docs: fixed examples for pipeline in aggregation (#661)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xthierry authored and dplewis committed Aug 7, 2019
1 parent 562e916 commit a1c8ab0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions _includes/js/queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ You can group by a field.
```javascript
// score is the field. $ before score lets the database know this is a field
var pipeline = [
group: { objectId: '$score' }
{ group: { objectId: '$score' } }
];
var query = new Parse.Query("User");
query.aggregate(pipeline)
Expand All @@ -480,7 +480,7 @@ You can apply collective calculations like $sum, $avg, $max, $min.
```javascript
// total will be a newly created field to hold the sum of score field
var pipeline = [
group: { objectId: null, total: { $sum: '$score' } }
{ group: { objectId: null, total: { $sum: '$score' } } }
];
var query = new Parse.Query("User");
query.aggregate(pipeline)
Expand All @@ -496,7 +496,7 @@ Project pipeline is similar to `keys` or `select`, add or remove existing fields

```javascript
var pipeline = [
project: { name: 1 }
{ project: { name: 1 } }
];
var query = new Parse.Query("User");
query.aggregate(pipeline)
Expand Down Expand Up @@ -528,7 +528,7 @@ You can match by comparison.

```javascript
var pipeline = [
match: { score: { $gt: 15 } }
{ match: { score: { $gt: 15 } } }
];
var query = new Parse.Query("User");
query.aggregate(pipeline)
Expand Down Expand Up @@ -582,4 +582,4 @@ query.readPreference(
'SECONDARY_PREFERRED',
'NEAREST'
);
```
```

0 comments on commit a1c8ab0

Please sign in to comment.