-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
Fully Compatible
It appears that 4.2 changed the format in which it reports aggregate explain results.
4.0:
ruby-driver-rs:PRIMARY> db.test.explain().aggregate([]) { "stages" : [ { "$cursor" : { "query" : { }, "queryPlanner" : { "plannerVersion" : 1, "namespace" : "ruby-driver.test", "indexFilterSet" : false, "parsedQuery" : { }, "winningPlan" : { "stage" : "COLLSCAN", "direction" : "forward" }, "rejectedPlans" : [ ] } } } ], "ok" : 1, "operationTime" : Timestamp(1554485036, 1), "$clusterTime" : { "clusterTime" : Timestamp(1554485036, 1), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) } } }
4.2:
ruby-driver-rs:PRIMARY> db.test.explain().aggregate([]) { "queryPlanner" : { "plannerVersion" : 1, "namespace" : "ruby-driver.test", "indexFilterSet" : false, "parsedQuery" : { }, "queryHash" : "8B3D4AB8", "planCacheKey" : "8B3D4AB8", "optimizedPipeline" : true, "winningPlan" : { "stage" : "COLLSCAN", "direction" : "forward" }, "rejectedPlans" : [ ] }, "serverInfo" : { "host" : "speed", "port" : 27741, "version" : "4.1.9-283-g1b75c7b9b1", "gitVersion" : "1b75c7b9b1295fa8a94552da7f2c63cbc2cc2105" }, "ok" : 1, "$clusterTime" : { "clusterTime" : Timestamp(1554484992, 1), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) } }, "operationTime" : Timestamp(1554484992, 1) }
The `queryPlanner` key got moved to top level where previously it was under `stages` key. The driver expects the response to have a `stages` key and fails thusly on 4.2:
1) ./spec/mongo/collection/view/aggregation_spec.rb[1:4:1]
Mongo::Collection::View::Aggregation#explain executes an explain
NoMethodError: undefined method `[]' for nil:NilClass
/data/mci/a01d1b690953c11a290f354659ef7fdc/src/lib/mongo/operation/aggregate/result.rb:68:in `documents'
/data/mci/a01d1b690953c11a290f354659ef7fdc/src/lib/mongo/cursor.rb:298:in `process'
/data/mci/a01d1b690953c11a290f354659ef7fdc/src/lib/mongo/cursor.rb:123:in `each'
/data/mci/a01d1b690953c11a290f354659ef7fdc/src/lib/mongo/collection/view/iterable.rb:45:in `each'
/data/mci/a01d1b690953c11a290f354659ef7fdc/src/lib/mongo/collection/view/aggregation.rb:88:in `first'
/data/mci/a01d1b690953c11a290f354659ef7fdc/src/lib/mongo/collection/view/aggregation.rb:88:in `explain'
/data/mci/a01d1b690953c11a290f354659ef7fdc/src/spec/mongo/collection/view/aggregation_spec.rb:224:in `block (3 levels) in <top (required)>'
- is caused by
-
SERVER-24860 Optimize away entire pipeline if it can be answered using a query
- Closed
- is related to
-
RUBY-2047 Test 3.6 driver against 4.2 servers
- Closed
- related to
-
PHPLIB-431 Relax aggregate explain test for 4.2 servers
- Closed
- links to