$changeStream parsing doesn't correctly check that its argument is a nested object

XMLWordPrintableJSON

    • Fully Compatible
    • ALL
    • Query 2018-05-07
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The parser for a $changeStream stage does not correctly check that its argument is a nested object. The following command trips a verify(), causing a stack trace to be logged, and causing the process to shutdown for debug builds:

      > db.c.aggregate([{$changeStream: 1}])
      assert: command failed: {
      	"ok" : 0,
      	"errmsg" : "assertion src/mongo/bson/bsonelement.cpp:557",
      	"code" : 8,
      	"codeName" : "UnknownError"
      } : aggregate failed
      _getErrorWithCode@src/mongo/shell/utils.js:25:13
      doassert@src/mongo/shell/assert.js:16:14
      _assertCommandWorked@src/mongo/shell/assert.js:510:17
      assert.commandWorked@src/mongo/shell/assert.js:594:16
      DB.prototype._runAggregate@src/mongo/shell/db.js:260:9
      DBCollection.prototype.aggregate@src/mongo/shell/collection.js:1057:12
      @(shell):1:1
      

      Instead, DocumentSourceChangeStream::createFromBson() should throw a UserException with a more useful error message.

            Assignee:
            Ian Boros
            Reporter:
            David Storch
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: