@@ -118,7 +118,7 @@ public void List_get_Item_of_scalar_should_work()
118118 var expectedStages = new [ ]
119119 {
120120 "{ $group : { _id : '$_id', _elements : { $push: '$X' } } }" ,
121- "{ $project : { _id : '$_id' Result : { $arrayElemAt : ['$_elements', 0] } } }" ,
121+ "{ $project : { _id : '$_id', Result : { $arrayElemAt : ['$_elements', 0] } } }" ,
122122 "{ $sort : { _id : 1 } }"
123123 } ;
124124 AssertStages ( stages , expectedStages ) ;
@@ -1043,7 +1043,7 @@ public void IGrouping_First_with_predicate_of_root_should_work()
10431043 var expectedStages = new [ ]
10441044 {
10451045 "{ $group : { _id : '$_id', _elements : { $push : '$$ROOT' } } }" ,
1046- "{ $project : { _id : '$_id', Result : { $arrayElemAt : [{ $filter : { input : '$_elements', as : 'e', cond : { $ne : ['$$e.X', 1] } } }, 0] } } }" ,
1046+ "{ $project : { _id : '$_id', Result : { $arrayElemAt : [{ $filter : { input : '$_elements', as : 'e', cond : { $ne : ['$$e.X', 1] }, limit : 1 } }, 0] } } }" ,
10471047 "{ $sort : { _id : 1 } }"
10481048 } ;
10491049 AssertStages ( stages , expectedStages ) ;
@@ -1068,7 +1068,7 @@ public void IGrouping_First_with_predicate_of_scalar_should_work()
10681068 var expectedStages = new [ ]
10691069 {
10701070 "{ $group : { _id : '$_id', _elements : { $push : '$X' } } }" ,
1071- "{ $project : { _id : '$_id', Result : { $arrayElemAt : [{ $filter : { input : '$_elements', as : 'e', cond : { $ne : ['$$e', 1] } } }, 0] } } }" ,
1071+ "{ $project : { _id : '$_id', Result : { $arrayElemAt : [{ $filter : { input : '$_elements', as : 'e', cond : { $ne : ['$$e', 1] }, limit : 1 } }, 0] } } }" ,
10721072 "{ $sort : { _id : 1 } }"
10731073 } ;
10741074 AssertStages ( stages , expectedStages ) ;
@@ -1143,7 +1143,7 @@ public void IGrouping_FirstOrDefault_with_predicate_of_root_should_work()
11431143 var expectedStages = new [ ]
11441144 {
11451145 "{ $group : { _id : '$_id', _elements : { $push : '$$ROOT' } } }" ,
1146- "{ $project : { _id : '$_id', Result : { $let : { vars : { values : { $filter : { input : '$_elements', as : 'e', cond : { $ne : ['$$e.X', 1] } } } }, in : { $cond : { if : { $eq : [{ $size : '$$values' }, 0] }, then : null, else : { $arrayElemAt : ['$$values', 0] } } } } } } }" ,
1146+ "{ $project : { _id : '$_id', Result : { $let : { vars : { values : { $filter : { input : '$_elements', as : 'e', cond : { $ne : ['$$e.X', 1] }, limit : 1 } } }, in : { $cond : { if : { $eq : [{ $size : '$$values' }, 0] }, then : null, else : { $arrayElemAt : ['$$values', 0] } } } } } } }" ,
11471147 "{ $sort : { _id : 1 } }"
11481148 } ;
11491149 AssertStages ( stages , expectedStages ) ;
@@ -1169,7 +1169,7 @@ public void IGrouping_FirstOrDefault_with_predicate_of_scalar_should_work()
11691169 var expectedStages = new [ ]
11701170 {
11711171 "{ $group : { _id : '$_id', _elements : { $push : '$X' } } }" ,
1172- "{ $project : { _id : '$_id', Result : { $let : { vars : { values : { $filter : { input : '$_elements', as : 'e', cond : { $ne : ['$$e', 1] } } } }, in : { $cond : { if : { $eq : [{ $size : '$$values' }, 0] }, then : 0, else : { $arrayElemAt : ['$$values', 0] } } } } } } }" ,
1172+ "{ $project : { _id : '$_id', Result : { $let : { vars : { values : { $filter : { input : '$_elements', as : 'e', cond : { $ne : ['$$e', 1] }, limit : 1 } } }, in : { $cond : { if : { $eq : [{ $size : '$$values' }, 0] }, then : 0, else : { $arrayElemAt : ['$$values', 0] } } } } } } }" ,
11731173 "{ $sort : { _id : 1 } }"
11741174 } ;
11751175 AssertStages ( stages , expectedStages ) ;
0 commit comments