[SERVER-34662] $changeStream parsing doesn't correctly check that its argument is a nested object Created: 24/Apr/18  Updated: 29/Oct/23  Resolved: 26/Apr/18

Status: Closed
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: None
Fix Version/s: 4.0.0-rc0

Type: Bug Priority: Major - P3
Reporter: David Storch Assignee: Ian Boros
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Query 2018-05-07
Participants:

 Description   

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.



 Comments   
Comment by Githook User [ 26/Apr/18 ]

Author:

{'email': 'ian.boros@10gen.com', 'name': 'Ian Boros'}

Message: SERVER-34662 fix $changeStream parsing to check that its argument is an object
Branch: master
https://github.com/mongodb/mongo/commit/d881559e5c847bb422687a72ce10c263f1ef68cc

Generated at Thu Feb 08 04:37:25 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.