diff options
Diffstat (limited to 'jstests/noPassthroughWithMongod/group_pushdown.js')
-rw-r--r-- | jstests/noPassthroughWithMongod/group_pushdown.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/jstests/noPassthroughWithMongod/group_pushdown.js b/jstests/noPassthroughWithMongod/group_pushdown.js index 0f127a67792..adfeda64b74 100644 --- a/jstests/noPassthroughWithMongod/group_pushdown.js +++ b/jstests/noPassthroughWithMongod/group_pushdown.js @@ -296,6 +296,14 @@ assertResultsMatchWithAndWithoutGroupPushdown( [{"_id": 1, "s": 2}, {"_id": 2, "s": 2}, {"_id": 4, "s": 1}], 2); +// Verifies that an optimized expression can be pushed down. +assertResultsMatchWithAndWithoutGroupPushdown( + coll, + // {"$ifNull": [1, 2]} will be optimized into just the constant 1. + [{$group: {_id: {"$ifNull": [1, 2]}, o: {$min: "$quantity"}}}], + [{"_id": 1, o: 1}], + 1); + // Run a group with a supported $stdDevSamp accumultor and check that it gets pushed down. assertGroupPushdown(coll, [{$group: {_id: "$item", s: {$stdDevSamp: "$quantity"}}}], |