SERVER-110061 Replace specific error codes with BSONObjectTooLarge (#42601)

GitOrigin-RevId: f64b5d7813213e71c2a4b2dbd4a7e8fe7bc570a4
This commit is contained in:
Jan 2025-10-14 16:23:54 +02:00 committed by MongoDB Bot
parent 8030ef7da2
commit 1a0139d7f0
3 changed files with 4 additions and 4 deletions

View File

@ -79,7 +79,7 @@ assert.commandFailedWithCode(
ordered: true,
updates: [{q: {_id: objectId}, u: {_id: objectId, x: largerThanMaxString}, upsert: true}],
}),
17420,
ErrorCodes.BSONObjectTooLarge,
);
coll = db.getCollection(collNamePrefix + "update_over_size_limit");
@ -91,5 +91,5 @@ assert.commandFailedWithCode(
ordered: true,
updates: [{q: {_id: objectId}, u: {$set: {x: largerThanMaxString}}}],
}),
[17419, ErrorCodes.BSONObjectTooLarge],
ErrorCodes.BSONObjectTooLarge,
);

View File

@ -322,7 +322,7 @@ BSONObj UpdateStage::transformAndUpdate(const Snapshotted<BSONObj>& oldObj,
newObj = _doc.getObject();
if (!DocumentValidationSettings::get(opCtx()).isInternalValidationDisabled()) {
uassert(17419,
uassert(ErrorCodes::BSONObjectTooLarge,
str::stream() << "Resulting document after update is larger than "
<< BSONObjMaxUserSize,
newObj.objsize() <= BSONObjMaxUserSize);

View File

@ -263,7 +263,7 @@ BSONObj UpsertStage::_produceNewDocumentForInsert() {
auto newDocument = _doc.getObject();
if (!DocumentValidationSettings::get(opCtx()).isInternalValidationDisabled()) {
uassert(17420,
uassert(ErrorCodes::BSONObjectTooLarge,
str::stream() << "Document to upsert is larger than " << BSONObjMaxUserSize,
newDocument.objsize() <= BSONObjMaxUserSize);
}