@@ -14,7 +14,7 @@ describe('Parse Aggregate Query', () => {
1414
1515 it ( 'aggregate pipeline object query' , done => {
1616 const pipeline = {
17- group : { objectId : '$name' } ,
17+ $ group : { _id : '$name' } ,
1818 } ;
1919 const query = new Parse . Query ( TestObject ) ;
2020 query . aggregate ( pipeline ) . then ( results => {
@@ -24,7 +24,7 @@ describe('Parse Aggregate Query', () => {
2424 } ) ;
2525
2626 it ( 'aggregate pipeline array query' , done => {
27- const pipeline = [ { group : { objectId : '$name' } } ] ;
27+ const pipeline = [ { $ group : { _id : '$name' } } ] ;
2828 const query = new Parse . Query ( TestObject ) ;
2929 query . aggregate ( pipeline ) . then ( results => {
3030 assert . equal ( results . length , 3 ) ;
@@ -53,17 +53,17 @@ describe('Parse Aggregate Query', () => {
5353
5454 const pipeline = [
5555 {
56- match : { name : 'Hello' } ,
56+ $ match : { name : 'Hello' } ,
5757 } ,
5858 {
5959 // Transform className$objectId to objectId and store in new field tempPointer
60- project : {
60+ $ project : {
6161 tempPointer : { $substr : [ '$_p_pointer' , 11 , - 1 ] } , // Remove TestObject$
6262 } ,
6363 } ,
6464 {
6565 // Left Join, replace objectId stored in tempPointer with an actual object
66- lookup : {
66+ $ lookup : {
6767 from : 'TestObject' ,
6868 localField : 'tempPointer' ,
6969 foreignField : '_id' ,
@@ -72,12 +72,12 @@ describe('Parse Aggregate Query', () => {
7272 } ,
7373 {
7474 // lookup returns an array, Deconstructs an array field to objects
75- unwind : {
75+ $ unwind : {
7676 path : '$tempPointer' ,
7777 } ,
7878 } ,
7979 {
80- match : { 'tempPointer.value' : 2 } ,
80+ $ match : { 'tempPointer.value' : 2 } ,
8181 } ,
8282 ] ;
8383 await Parse . Object . saveAll ( [ pointer1 , pointer2 , pointer3 , obj1 , obj2 , obj3 ] ) ;
@@ -91,7 +91,7 @@ describe('Parse Aggregate Query', () => {
9191
9292 it ( 'aggregate pipeline on top of a simple query' , async done => {
9393 const pipeline = {
94- group : { objectId : '$name' } ,
94+ $ group : { _id : '$name' } ,
9595 } ;
9696 let results = await new Parse . Query ( TestObject ) . equalTo ( 'name' , 'foo' ) . aggregate ( pipeline ) ;
9797
0 commit comments