@@ -178,7 +178,7 @@ void testQueryWithDistinct() throws SQLException {
178
178
BsonDocument .parse ("{\" $group\" : {\" _id\" : \" $array.field\" }}" ),
179
179
result .getAggregateOperations ().get (2 ));
180
180
Assertions .assertEquals (
181
- BsonDocument .parse ("{\" $project\" : {\" array. field\" : \" $_id\" }}" ),
181
+ BsonDocument .parse ("{\" $project\" : {\" field\" : \" $_id\" }}" ),
182
182
result .getAggregateOperations ().get (3 ));
183
183
}
184
184
@@ -475,11 +475,11 @@ void testQueryWithGroupBy() throws SQLException {
475
475
result .getAggregateOperations ().get (1 ));
476
476
Assertions .assertEquals (
477
477
BsonDocument .parse (
478
- "{\" $group\" : {\" _id\" : {\" _id \" : \" $_id\" , \" array_field \" : \" $array.field\" , \" array_field1 \" : \" $array.field1\" }}}" ),
478
+ "{\" $group\" : {\" _id\" : {\" testCollection__id \" : \" $_id\" , \" field \" : \" $array.field\" , \" field1 \" : \" $array.field1\" }}}" ),
479
479
result .getAggregateOperations ().get (2 ));
480
480
Assertions .assertEquals (
481
481
BsonDocument .parse (
482
- "{\" $project\" : {\" _id\" : \" $_id._id \" , \" array. field\" : \" $_id.array_field \" , \" array. field1\" : \" $_id.array_field1 \" }}" ),
482
+ "{\" $project\" : {\" _id\" : 0, \" testCollection__id \" : \" $_id.testCollection__id \" , \" field\" : \" $_id.field \" , \" field1\" : \" $_id.field1 \" }}" ),
483
483
result .getAggregateOperations ().get (3 ));
484
484
}
485
485
@@ -777,7 +777,7 @@ void testQueryWithHaving() throws SQLException {
777
777
Assertions .assertNotNull (result );
778
778
Assertions .assertEquals (COLLECTION_NAME , result .getCollectionName ());
779
779
Assertions .assertEquals (3 , result .getColumnMetaData ().size ());
780
- Assertions .assertEquals (8 , result .getAggregateOperations ().size ());
780
+ Assertions .assertEquals (6 , result .getAggregateOperations ().size ());
781
781
Assertions .assertEquals (
782
782
BsonDocument .parse (
783
783
"{ \" $unwind\" : {"
@@ -793,33 +793,19 @@ void testQueryWithHaving() throws SQLException {
793
793
result .getAggregateOperations ().get (1 ));
794
794
Assertions .assertEquals (
795
795
BsonDocument .parse (
796
- "{\" $group\" : {\" _id\" : {\" _id \" : \" $_id\" , \" array_field \" : \" $array.field\" , \" array_field1 \" : \" $array.field1\" }, \" _f3\" : {\" $sum\" : 1}}}" ),
796
+ "{\" $group\" : {\" _id\" : {\" testCollection__id \" : \" $_id\" , \" field \" : \" $array.field\" , \" field1 \" : \" $array.field1\" }, \" _f3\" : {\" $sum\" : 1}}}" ),
797
797
result .getAggregateOperations ().get (2 ));
798
798
Assertions .assertEquals (
799
799
BsonDocument .parse (
800
- "{\" $project\" : {\" _id\" : \" $_id._id \" , \" array. field\" : \" $_id.array_field \" , \" array. field1\" : \" $_id.array_field1 \" , \" _f3\" : \" $_f3\" }}" ),
800
+ "{\" $project\" : {\" _id\" : 0, \" testCollection__id \" : \" $_id.testCollection__id \" , \" field\" : \" $_id.field \" , \" field1\" : \" $_id.field1 \" , \" _f3\" : \" $_f3\" }}" ),
801
801
result .getAggregateOperations ().get (3 ));
802
802
Assertions .assertEquals (
803
- BsonDocument .parse (
804
- "{\" $project\" : "
805
- + "{\" _id\" : 1, "
806
- + "\" array.field\" : 1, "
807
- + "\" array.field1\" : 1, \" "
808
- + "_f3\" : 1, "
809
- + DocumentDbFilter .BOOLEAN_FLAG_FIELD
810
- + ": {\" $cond\" : [{\" $and\" : ["
811
- + "{\" $gt\" : [\" $_f3\" , null]}, "
812
- + "{\" $gt\" : [{\" $literal\" : 1}, null]}]}, "
813
- + "{\" $gt\" : [\" $_f3\" , {\" $literal\" : 1}]}, null]}}}" ),
803
+ BsonDocument .parse ("{\" $match\" : {\" _f3\" : {\" $gt\" : 1}}}" ),
814
804
result .getAggregateOperations ().get (4 ));
815
805
Assertions .assertEquals (
816
806
BsonDocument .parse (
817
- "{\" $match \" : {" + DocumentDbFilter . BOOLEAN_FLAG_FIELD + ": { \" $eq \" : true} }}" ),
807
+ "{\" $project \" : {\" testCollection__id \" : \" $testCollection__id \" , \" field \" : \" $field \" , \" field1 \" : \" $field1 \" , \" _id \" : 0 }}" ),
818
808
result .getAggregateOperations ().get (5 ));
819
- Assertions .assertEquals (
820
- BsonDocument .parse (
821
- "{\" $project\" : {" + DocumentDbFilter .BOOLEAN_FLAG_FIELD + ": 0}}" ),
822
- result .getAggregateOperations ().get (6 ));
823
809
}
824
810
825
811
@ Test
@@ -861,21 +847,20 @@ void testComplexQuery() throws SQLException {
861
847
result .getAggregateOperations ().get (2 ));
862
848
Assertions .assertEquals (
863
849
BsonDocument .parse (
864
- "{\" $group\" : " +
865
- "{\" _id\" : {\" _id\" : \" $_id\" , " +
866
- "\" array_field\" : \" $array.field\" , \" array_field1\" : \" $array.field1\" }, " +
867
- "\" Total\" : {\" $sum\" : 1}}}" ),
850
+ "{\" $group\" : {"
851
+ + "\" _id\" : {\" testCollection__id\" : \" $_id\" , \" field\" : \" $array.field\" , \" field1\" : \" $array.field1\" }, "
852
+ + "\" Total\" : {\" $sum\" : 1}}}" ),
868
853
result .getAggregateOperations ().get (3 ));
869
854
Assertions .assertEquals (
870
- BsonDocument .parse ("{ \" $project \" : { \" _id \" : \" $_id._id \" , " +
871
- "\" array. field\" : \" $_id.array_field \" , \" array. field1\" : \" $_id.array_field1 \" , \" Total\" : \" $Total\" }}" ),
855
+ BsonDocument .parse (
856
+ "{ \" $project \" : { \" _id \" : 0, \" testCollection__id \" : \" $_id.testCollection__id \" , \" field\" : \" $_id.field \" , \" field1\" : \" $_id.field1 \" , \" Total\" : \" $Total\" }}" ),
872
857
result .getAggregateOperations ().get (4 ));
873
858
Assertions .assertEquals (
874
859
BsonDocument .parse ("{\" $match\" : {\" Total\" : {\" $gt\" : 1}}}" ),
875
860
result .getAggregateOperations ().get (5 ));
876
861
Assertions .assertEquals (
877
862
BsonDocument .parse (
878
- "{\" $project\" : {\" testCollection__id\" : \" $_id \" , \" renamed\" : \" $array. field\" , \" Total\" : \" $Total\" , \" _id\" : 0}}" ),
863
+ "{\" $project\" : {\" testCollection__id\" : \" $testCollection__id \" , \" renamed\" : \" $field\" , \" Total\" : \" $Total\" , \" _id\" : 0}}" ),
879
864
result .getAggregateOperations ().get (6 ));
880
865
Assertions .assertEquals (
881
866
BsonDocument .parse ("{\" $sort\" : {\" renamed\" : 1}}" ),
@@ -1074,18 +1059,18 @@ void testComplexQueryWithSameCollectionJoin() throws SQLException {
1074
1059
result .getAggregateOperations ().get (3 ));
1075
1060
Assertions .assertEquals (
1076
1061
BsonDocument .parse (
1077
- "{\" $group\" : {\" _id\" : {\" _id \" : \" $_id\" , \" array_field \" : \" $array.field\" , \" array_field1 \" : \" $array.field1\" }, \" Total\" : {\" $sum\" : 1}}}" ),
1062
+ "{\" $group\" : {\" _id\" : {\" testCollection__id \" : \" $_id\" , \" field \" : \" $array.field\" , \" field1 \" : \" $array.field1\" }, \" Total\" : {\" $sum\" : 1}}}" ),
1078
1063
result .getAggregateOperations ().get (4 ));
1079
1064
Assertions .assertEquals (
1080
1065
BsonDocument .parse (
1081
- "{\" $project\" : {\" _id\" : \" $_id._id \" , \" array. field\" : \" $_id.array_field \" , \" array. field1\" : \" $_id.array_field1 \" , \" Total\" : \" $Total\" }}" ),
1066
+ "{\" $project\" : {\" _id\" : 0, \" testCollection__id \" : \" $_id.testCollection__id \" , \" field\" : \" $_id.field \" , \" field1\" : \" $_id.field1 \" , \" Total\" : \" $Total\" }}" ),
1082
1067
result .getAggregateOperations ().get (5 ));
1083
1068
Assertions .assertEquals (
1084
1069
BsonDocument .parse ("{\" $match\" : {\" Total\" : {\" $gt\" : 1}}}" ),
1085
1070
result .getAggregateOperations ().get (6 ));
1086
1071
Assertions .assertEquals (
1087
1072
BsonDocument .parse (
1088
- "{\" $project\" : {\" renamed\" : \" $array. field\" , \" Total\" : \" $Total\" , \" _id\" : 0}}" ),
1073
+ "{\" $project\" : {\" renamed\" : \" $field\" , \" Total\" : \" $Total\" , \" _id\" : 0}}" ),
1089
1074
result .getAggregateOperations ().get (7 ));
1090
1075
Assertions .assertEquals (
1091
1076
BsonDocument .parse ("{\" $sort\" : {\" renamed\" : 1}}" ),
@@ -1295,18 +1280,18 @@ void testComplexQueryWithDifferentCollectionJoin() throws SQLException {
1295
1280
result .getAggregateOperations ().get (2 ));
1296
1281
Assertions .assertEquals (
1297
1282
BsonDocument .parse (
1298
- "{\" $group\" : {\" _id\" : {\" _id \" : \" $_id\" , \" testCollection_array_array_field \" : \" $testCollection_array.array.field\" , \" testCollection_array_array_field1 \" : \" $testCollection_array.array.field1\" }, \" Total\" : {\" $sum\" : 1}}}" ),
1283
+ "{\" $group\" : {\" _id\" : {\" otherTestCollection__id \" : \" $_id\" , \" field \" : \" $testCollection_array.array.field\" , \" field1 \" : \" $testCollection_array.array.field1\" }, \" Total\" : {\" $sum\" : 1}}}" ),
1299
1284
result .getAggregateOperations ().get (3 ));
1300
1285
Assertions .assertEquals (
1301
1286
BsonDocument .parse (
1302
- "{\" $project\" : {\" _id\" : \" $_id._id \" , \" testCollection_array.array. field\" : \" $_id.testCollection_array_array_field \" , \" testCollection_array.array. field1\" : \" $_id.testCollection_array_array_field1 \" , \" Total\" : \" $Total\" }}" ),
1287
+ "{\" $project\" : {\" _id\" : 0, \" otherTestCollection__id \" : \" $_id.otherTestCollection__id \" , \" field\" : \" $_id.field \" , \" field1\" : \" $_id.field1 \" , \" Total\" : \" $Total\" }}" ),
1303
1288
result .getAggregateOperations ().get (4 ));
1304
1289
Assertions .assertEquals (
1305
1290
BsonDocument .parse ("{\" $match\" : {\" Total\" : {\" $gt\" : 1}}}" ),
1306
1291
result .getAggregateOperations ().get (5 ));
1307
1292
Assertions .assertEquals (
1308
1293
BsonDocument .parse (
1309
- "{\" $project\" : {\" renamed\" : \" $testCollection_array.array. field\" , \" Total\" : \" $Total\" , \" _id\" : 0}}" ),
1294
+ "{\" $project\" : {\" renamed\" : \" $field\" , \" Total\" : \" $Total\" , \" _id\" : 0}}" ),
1310
1295
result .getAggregateOperations ().get (6 ));
1311
1296
Assertions .assertEquals (
1312
1297
BsonDocument .parse ("{\" $sort\" : {\" renamed\" : 1}}" ),
0 commit comments