From 1b872d51239f9a4851dfc2bed702ec84e98faf84 Mon Sep 17 00:00:00 2001 From: Thierry Santos Date: Wed, 7 Aug 2019 15:14:21 -0300 Subject: [PATCH] docs: fixed examples for pipeline in aggregation --- _includes/js/queries.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/_includes/js/queries.md b/_includes/js/queries.md index afc29383c..56ea5c325 100644 --- a/_includes/js/queries.md +++ b/_includes/js/queries.md @@ -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) @@ -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) @@ -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) @@ -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) @@ -582,4 +582,4 @@ query.readPreference( 'SECONDARY_PREFERRED', 'NEAREST' ); -``` \ No newline at end of file +```