[SERVER-13172] Cryptic error when trying to update with a valid big document Created: 12/Mar/14  Updated: 11/Jul/16  Resolved: 17/Mar/14

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: 2.6.0-rc1
Fix Version/s: 2.7.0

Type: Bug Priority: Major - P3
Reporter: Randolph Tan Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-12977 Write commands should error on empty ... Closed
Related
is related to SERVER-12763 Shell insert method provides confusin... Closed
Operating System: ALL
Participants:

 Description   

Running the code below:

var maxBsonObjectSize = db.isMaster().maxBsonObjectSize;
var docOverhead = Object.bsonsize({ _id: new ObjectId(), x: '' });
var maxStrSize = maxBsonObjectSize - docOverhead;
 
var maxStr = 'a';
while (maxStr.length < maxStrSize) maxStr += 'a';
 
var coll = db.max_doc_size;
 
coll.drop();
var id = new ObjectId();
coll.insert({ _id: id });
assert.writeOK(coll.update({ _id: id }, { $set: { x: maxStr }}));

Results in the shell throwing "Cannot output SingleWriteResult from multiple batch result". This appears to be a problem in the splitting logic inside the addToOperationsList method in bulk_api.js.



 Comments   
Comment by Randolph Tan [ 17/Mar/14 ]

Changes in bulk_api.js of this commit fixed the issue:

https://github.com/mongodb/mongo/commit/b5756056a7b5acba550a7d31a587f3a5b7651e00

Generated at Thu Feb 08 03:30:52 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.