-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Optimization
-
Fully Compatible
-
ALL
-
QO 2025-02-17
-
None
-
3
-
None
-
None
-
None
-
None
-
None
-
None
> db.adminCommand({setParameter:1, planRankerMode: "heuristicCE"}) > db.c.insert({_id: 1}) > db.c.createIndex({a: 1, 'b.c': 1}) > db.c.find({ a: 1, $or: [ {a: 2}, {b: {$elemMatch: {$or: [{c: 4}, {c: 5}]}}} ] }) MongoServerError: There cannot be other sub-plans parallel to a FetchNode
The plan that this query generates is
winningPlan: { isCached: false, stage: 'FETCH', inputStage: { stage: 'OR', inputStages: [ { stage: 'IXSCAN', keyPattern: { a: 1, 'b.c': 1 }, indexName: 'a_1_b.c_1', isMultiKey: false, multiKeyPaths: { a: [], 'b.c': [] }, isUnique: false, isSparse: false, isPartial: false, indexVersion: 2, direction: 'forward', indexBounds: { a: [], 'b.c': [ '[MinKey, MaxKey]' ] } }, { stage: 'FETCH', filter: { b: { '$elemMatch': { c: { '$in': [ 4, 5 ] } } } }, inputStage: { stage: 'IXSCAN', keyPattern: { a: 1, 'b.c': 1 }, indexName: 'a_1_b.c_1', isMultiKey: false, multiKeyPaths: { a: [], 'b.c': [] }, isUnique: false, isSparse: false, isPartial: false, indexVersion: 2, direction: 'forward', indexBounds: { a: [ '[1, 1]' ], 'b.c': [ '[4, 4]', '[5, 5]' ] } } } ] } },
CBR currently does not support this plan shape which has two Fetches nested under each other.