-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 1.6.0
-
Component/s: Explain
-
None
-
Environment:OS:
node.js / npm versions:
Additional info:
-
1
-
Iteration Iguanodon
-
Not Needed
Legacy shell does not allow to add explain after the aggregation command (e.g. db.foo.aggregate([.....]).explain(). mongosh allows that but the behaviour is not consistent.
The following aggregation is executed as expected without the "executionStats" option
db.foo.aggregate([{$match: {a:4}}, {$match: {$expr: { $eq: [{$last: "$a"},4]}}}]).explain()
Instead the following aggregation even if we don't have the option executionStats it's executed as the option was there (not expected).
db.foo.aggregate([{$match: {a:4}},{$project: {a: {$last: "$a"}}},{$match: {a:4}}]).explain()
Note that this does not happen if we use the syntax db.foo.explain().aggregation([....])