@@ -14,7 +14,7 @@ describe('Parse Aggregate Query', () => {
14
14
15
15
it ( 'aggregate pipeline object query' , done => {
16
16
const pipeline = {
17
- group : { objectId : '$name' } ,
17
+ $ group : { _id : '$name' } ,
18
18
} ;
19
19
const query = new Parse . Query ( TestObject ) ;
20
20
query . aggregate ( pipeline ) . then ( results => {
@@ -24,7 +24,7 @@ describe('Parse Aggregate Query', () => {
24
24
} ) ;
25
25
26
26
it ( 'aggregate pipeline array query' , done => {
27
- const pipeline = [ { group : { objectId : '$name' } } ] ;
27
+ const pipeline = [ { $ group : { _id : '$name' } } ] ;
28
28
const query = new Parse . Query ( TestObject ) ;
29
29
query . aggregate ( pipeline ) . then ( results => {
30
30
assert . equal ( results . length , 3 ) ;
@@ -53,17 +53,17 @@ describe('Parse Aggregate Query', () => {
53
53
54
54
const pipeline = [
55
55
{
56
- match : { name : 'Hello' } ,
56
+ $ match : { name : 'Hello' } ,
57
57
} ,
58
58
{
59
59
// Transform className$objectId to objectId and store in new field tempPointer
60
- project : {
60
+ $ project : {
61
61
tempPointer : { $substr : [ '$_p_pointer' , 11 , - 1 ] } , // Remove TestObject$
62
62
} ,
63
63
} ,
64
64
{
65
65
// Left Join, replace objectId stored in tempPointer with an actual object
66
- lookup : {
66
+ $ lookup : {
67
67
from : 'TestObject' ,
68
68
localField : 'tempPointer' ,
69
69
foreignField : '_id' ,
@@ -72,12 +72,12 @@ describe('Parse Aggregate Query', () => {
72
72
} ,
73
73
{
74
74
// lookup returns an array, Deconstructs an array field to objects
75
- unwind : {
75
+ $ unwind : {
76
76
path : '$tempPointer' ,
77
77
} ,
78
78
} ,
79
79
{
80
- match : { 'tempPointer.value' : 2 } ,
80
+ $ match : { 'tempPointer.value' : 2 } ,
81
81
} ,
82
82
] ;
83
83
await Parse . Object . saveAll ( [ pointer1 , pointer2 , pointer3 , obj1 , obj2 , obj3 ] ) ;
@@ -91,7 +91,7 @@ describe('Parse Aggregate Query', () => {
91
91
92
92
it ( 'aggregate pipeline on top of a simple query' , async done => {
93
93
const pipeline = {
94
- group : { objectId : '$name' } ,
94
+ $ group : { _id : '$name' } ,
95
95
} ;
96
96
let results = await new Parse . Query ( TestObject ) . equalTo ( 'name' , 'foo' ) . aggregate ( pipeline ) ;
97
97
0 commit comments