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 {
32
32
33
33
static BsonDocument getKeyPattern (BsonDocument explainPlan ) {
34
34
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' )) {
36
41
return winningPlan. getDocument(' inputStage' ). getDocument(' keyPattern' )
37
42
} else if (winningPlan. containsKey(' shards' )) {
38
43
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 {
418
418
def caseInsensitiveCollation = Collation . builder(). locale(' en' ). collationStrength(CollationStrength . SECONDARY ). build()
419
419
420
420
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 ) {
422
424
return explainPlan. queryPlanner. winningPlan. inputStage. keyPattern
423
425
} else if (explainPlan. queryPlanner. winningPlan. shards != null ) {
424
426
return explainPlan. queryPlanner. winningPlan. shards[0 ]. winningPlan. inputStage. keyPattern
You can’t perform that action at this time.
0 commit comments