Skip to content

docs(javascript): fixed examples for pipeline in aggregation #661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'
);
```
```