File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
driver-core/src/test/functional/com/mongodb/internal/operation
driver-legacy/src/test/functional/com/mongodb Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -40,8 +40,8 @@ class QueryOperationHelper {
40
40
} else if (winningPlan. containsKey(' inputStage' )) {
41
41
return winningPlan. getDocument(' inputStage' ). getDocument(' keyPattern' )
42
42
} else if (winningPlan. containsKey(' shards' )) {
43
- return winningPlan . getArray( ' shards' ) [0 ]. asDocument() . getDocument( ' winningPlan ' )
44
- .getDocument( ' inputStage ' ) . getDocument( ' keyPattern ' )
43
+ // recurse on shards[0] to get its query plan
44
+ return getKeyPattern( new BsonDocument ( ' queryPlanner ' , winningPlan . getArray( ' shards ' )[ 0 ] . asDocument()) )
45
45
}
46
46
}
47
47
}
Original file line number Diff line number Diff line change @@ -274,7 +274,12 @@ class DBCursorFunctionalSpecification extends FunctionalSpecification {
274
274
} else if (explainPlan. queryPlanner. winningPlan. inputStage != null ) {
275
275
return explainPlan. queryPlanner. winningPlan. inputStage. keyPattern
276
276
} else if (explainPlan. queryPlanner. winningPlan. shards != null ) {
277
- return explainPlan. queryPlanner. winningPlan. shards[0 ]. winningPlan. inputStage. keyPattern
277
+ def winningPlan = explainPlan. queryPlanner. winningPlan. shards[0 ]. winningPlan
278
+ if (winningPlan. queryPlan?. inputStage != null ) {
279
+ return winningPlan. queryPlan. inputStage. keyPattern
280
+ } else if (winningPlan. inputStage != null ) {
281
+ return winningPlan. inputStage. keyPattern
282
+ }
278
283
}
279
284
}
280
285
}
You can’t perform that action at this time.
0 commit comments