-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Query Optimization
Enterprise test> db.foo.aggregate([ { "$match": { "$and": [{ "a": 1 }, { "$or": [{ "b": "x" }, { "c": "y" }] }] } }]); MongoServerError[Location9768403]: FetchNode must have direct or indirect children that somehow filter data.
The plan looks like this:
winningPlan: { isCached: false, stage: 'FETCH', filter: { '$and': [ { a: { '$eq': 1 } }, { '$or': [ { b: { '$eq': 'x' } }, { c: { '$eq': 'y' } } ] } ] }, inputStage: { stage: 'AND_HASH', inputStages: [ { stage: 'IXSCAN', keyPattern: { a: 1 }, indexName: 'a_1', isMultiKey: false, multiKeyPaths: { a: [] }, isUnique: false, isSparse: false, isPartial: false, indexVersion: 2, direction: 'forward', indexBounds: { a: [ '[1, 1]' ] } }, { stage: 'OR', inputStages: [ { stage: 'IXSCAN', keyPattern: { b: 1 }, indexName: 'b_1', isMultiKey: false, multiKeyPaths: { b: [] }, isUnique: false, isSparse: false, isPartial: false, indexVersion: 2, direction: 'forward', indexBounds: { b: [ '["x", "x"]' ] } }, { stage: 'IXSCAN', keyPattern: { c: 1 }, indexName: 'c_1', isMultiKey: false, multiKeyPaths: { c: [] }, isUnique: false, isSparse: false, isPartial: false, indexVersion: 2, direction: 'forward', indexBounds: { c: [ '["y", "y"]' ] } } ] } ] } },