-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.2.0-rc0
-
Component/s: Aggregation Framework
-
Query Optimization
Currently, when an expression encounters an error, the pipeline fails, and gives some information about why it failed, but no information about which document caused it to fail:
2015-11-02T15:35:28.142-0500 E QUERY [thread1] Error: command failed: { "ok" : 0, "errmsg" : "$arrayElemAt's first argument must be an array, but is NumberDouble", "code" : 28689 } : aggregate failed : _getErrorWithCode@src/mongo/shell/utils.js:23:13 doassert@src/mongo/shell/assert.js:13:14 assert.commandWorked@src/mongo/shell/assert.js:259:5 DBCollection.prototype.aggregate@src/mongo/shell/collection.js:1211:5
It may be that most of your documents had the expected structure, but a select few have a different structure, causing the error. To make it easier to track down which was the offending document, the error message should include the document that was being processed when the error occurred.