File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
driver-core/src/test/functional/com/mongodb/operation
driver-legacy/src/test/functional/com/mongodb Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,12 @@ class QueryOperationHelper {
3232
3333 static BsonDocument getKeyPattern (BsonDocument explainPlan ) {
3434 BsonDocument winningPlan = explainPlan. getDocument(' queryPlanner' ). getDocument(' winningPlan' )
35- if (winningPlan. containsKey(' inputStage' )) {
35+ if (winningPlan. containsKey(' queryPlan' )) {
36+ BsonDocument queryPlan = winningPlan. getDocument(' queryPlan' )
37+ if (queryPlan. containsKey(' inputStage' )) {
38+ return queryPlan. getDocument(' inputStage' ). getDocument(' keyPattern' )
39+ }
40+ } else if (winningPlan. containsKey(' inputStage' )) {
3641 return winningPlan. getDocument(' inputStage' ). getDocument(' keyPattern' )
3742 } else if (winningPlan. containsKey(' shards' )) {
3843 return winningPlan. getArray(' shards' )[0 ]. asDocument(). getDocument(' winningPlan' )
Original file line number Diff line number Diff line change @@ -418,7 +418,9 @@ class DBCursorFunctionalSpecification extends FunctionalSpecification {
418418 def caseInsensitiveCollation = Collation . builder(). locale(' en' ). collationStrength(CollationStrength . SECONDARY ). build()
419419
420420 static DBObject getKeyPattern (DBObject explainPlan ) {
421- if (explainPlan. queryPlanner. winningPlan. inputStage != null ) {
421+ if (explainPlan. queryPlanner. winningPlan. queryPlan?. inputStage != null ) {
422+ return explainPlan. queryPlanner. winningPlan. queryPlan. inputStage. keyPattern
423+ } else if (explainPlan. queryPlanner. winningPlan. inputStage != null ) {
422424 return explainPlan. queryPlanner. winningPlan. inputStage. keyPattern
423425 } else if (explainPlan. queryPlanner. winningPlan. shards != null ) {
424426 return explainPlan. queryPlanner. winningPlan. shards[0 ]. winningPlan. inputStage. keyPattern
You can’t perform that action at this time.
0 commit comments