diff options
author | Henrik Edin <henrik.edin@mongodb.com> | 2018-11-30 11:14:16 -0500 |
---|---|---|
committer | Henrik Edin <henrik.edin@mongodb.com> | 2018-12-20 09:18:05 -0500 |
commit | 6b641e86656df78e9f7ad2f364dec35e19df332e (patch) | |
tree | db8f5ae4deb29e82d63b6f653eb7632d2b66b22b /jstests/aggregation | |
parent | fc1aa5592b8783dc802668659ec87826d789dd2f (diff) | |
download | mongo-6b641e86656df78e9f7ad2f364dec35e19df332e.tar.gz |
SERVER-38249 Implement stdx unordered_map and unordered_set as absl node hash map/set.
Remove stdx::unordered_multimap and multiset.
Custom hashers to stdx::unordered_map are not trusted by default, we
will rehash the produced hash with absl again to ensure we have a good
hash function.
Diffstat (limited to 'jstests/aggregation')
-rw-r--r-- | jstests/aggregation/bugs/server12015.js | 12 | ||||
-rw-r--r-- | jstests/aggregation/sources/facet/inner_graphlookup.js | 15 |
2 files changed, 19 insertions, 8 deletions
diff --git a/jstests/aggregation/bugs/server12015.js b/jstests/aggregation/bugs/server12015.js index 150ff30e708..1b59a59545c 100644 --- a/jstests/aggregation/bugs/server12015.js +++ b/jstests/aggregation/bugs/server12015.js @@ -63,19 +63,23 @@ load("jstests/aggregation/extras/utils.js"); // For orderedArrayEq. assertResultsMatch([{$sort: {a: -1, b: -1}}, {$project: {_id: 1, a: 1, b: 1}}]); assertResultsMatch([{$sort: {a: 1, b: 1}}, {$project: {_id: 1, a: 1, b: 1}}]); assertResultsMatch( - [{$sort: {a: 1, b: 1}}, {$group: {_id: "$_id", arr: {$push: "$a"}, sum: {$sum: "$b"}}}]); + [{$sort: {a: 1, b: 1}}, {$group: {_id: "$_id", arr: {$push: "$a"}, sum: {$sum: "$b"}}}], + ignoreSortOrder); // Non-blocking $sort, covered $project. assertResultsMatch([{$sort: {a: -1, b: -1}}, {$project: {_id: 0, a: 1, b: 1}}]); assertResultsMatch([{$sort: {a: 1, b: 1}}, {$project: {_id: 0, a: 1, b: 1}}]); - assertResultsMatch([{$sort: {a: 1, b: 1}}, {$group: {_id: "$b", arr: {$push: "$a"}}}]); + assertResultsMatch([{$sort: {a: 1, b: 1}}, {$group: {_id: "$b", arr: {$push: "$a"}}}], + ignoreSortOrder); // Blocking $sort, uncovered $project. assertResultsMatch([{$sort: {b: 1, a: -1}}, {$project: {_id: 1, a: 1, b: 1}}]); assertResultsMatch( - [{$sort: {b: 1, a: -1}}, {$group: {_id: "$_id", arr: {$push: "$a"}, sum: {$sum: "$b"}}}]); + [{$sort: {b: 1, a: -1}}, {$group: {_id: "$_id", arr: {$push: "$a"}, sum: {$sum: "$b"}}}], + ignoreSortOrder); // Blocking $sort, covered $project. assertResultsMatch([{$sort: {b: 1, a: -1}}, {$project: {_id: 0, a: 1, b: 1}}]); - assertResultsMatch([{$sort: {b: 1, a: -1}}, {$group: {_id: "$b", arr: {$push: "$a"}}}]); + assertResultsMatch([{$sort: {b: 1, a: -1}}, {$group: {_id: "$b", arr: {$push: "$a"}}}], + ignoreSortOrder); }()); diff --git a/jstests/aggregation/sources/facet/inner_graphlookup.js b/jstests/aggregation/sources/facet/inner_graphlookup.js index 870bb975a8a..340853f7721 100644 --- a/jstests/aggregation/sources/facet/inner_graphlookup.js +++ b/jstests/aggregation/sources/facet/inner_graphlookup.js @@ -30,14 +30,21 @@ as: "connected" } }; - const normalResults = graphColl.aggregate([graphLookupStage]).toArray(); - const facetedResults = graphColl.aggregate([{$facet: {nested: [graphLookupStage]}}]).toArray(); + + const projectStage = {$project: {_id: 1, edges: 1, connected_length: {$size: "$connected"}}}; + + const normalResults = graphColl.aggregate([graphLookupStage, projectStage]).toArray(); + const facetedResults = + graphColl.aggregate([{$facet: {nested: [graphLookupStage, projectStage]}}]).toArray(); assert.eq(facetedResults, [{nested: normalResults}]); + const sortStage = {$sort: {_id: 1, "connected._id": 1}}; + const normalResultsUnwound = - graphColl.aggregate([graphLookupStage, {$unwind: "$connected"}]).toArray(); + graphColl.aggregate([graphLookupStage, {$unwind: "$connected"}, sortStage]).toArray(); const facetedResultsUnwound = - graphColl.aggregate([{$facet: {nested: [graphLookupStage, {$unwind: "$connected"}]}}]) + graphColl + .aggregate([{$facet: {nested: [graphLookupStage, {$unwind: "$connected"}, sortStage]}}]) .toArray(); assert.eq(facetedResultsUnwound, [{nested: normalResultsUnwound}]); }()); |