diff options
author | Justin Seyster <justin.seyster@mongodb.com> | 2019-09-26 01:27:30 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-09-26 01:27:30 +0000 |
commit | c5540ac7d3ceb7c6ce8ff5a3354d80f3eb09dbf1 (patch) | |
tree | d006eab3c6850e9cee6229bf9a4d40b292986d24 /src/mongo/s/query/router_stage_pipeline.cpp | |
parent | 002fe351d66d5bfccea1e5a9659fbe8ec1c120dc (diff) | |
download | mongo-c5540ac7d3ceb7c6ce8ff5a3354d80f3eb09dbf1.tar.gz |
SERVER-42649 Use Value instead of BSONObj in the in-memory sort key
Diffstat (limited to 'src/mongo/s/query/router_stage_pipeline.cpp')
-rw-r--r-- | src/mongo/s/query/router_stage_pipeline.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mongo/s/query/router_stage_pipeline.cpp b/src/mongo/s/query/router_stage_pipeline.cpp index bfdd71fd104..4208f8fb254 100644 --- a/src/mongo/s/query/router_stage_pipeline.cpp +++ b/src/mongo/s/query/router_stage_pipeline.cpp @@ -99,7 +99,7 @@ BSONObj RouterStagePipeline::_validateAndConvertToBSON(const Document& event) { auto eventBSON = event.toBson(); auto resumeToken = event.metadata().getSortKey(); auto idField = eventBSON.getObjectField("_id"); - invariant(!resumeToken.isEmpty()); + invariant(!resumeToken.missing()); uassert(ErrorCodes::ChangeStreamFatalError, str::stream() << "Encountered an event whose _id field, which contains the resume " "token, was modified by the pipeline. Modifying the _id field of an " @@ -108,7 +108,8 @@ BSONObj RouterStagePipeline::_validateAndConvertToBSON(const Document& event) { "Expected: " << BSON("_id" << resumeToken) << " but found: " << (eventBSON["_id"] ? BSON("_id" << eventBSON["_id"]) : BSONObj()), - idField.binaryEqual(resumeToken)); + (resumeToken.getType() == BSONType::Object) && + idField.binaryEqual(resumeToken.getDocument().toBson())); // Return the event in BSONObj form, minus the $sortKey metadata. return eventBSON; |