[SERVER-11525] Provide nicer message when converting JS to BSON if too big Created: 01/Nov/13  Updated: 11/Jul/16  Resolved: 13/Nov/13

Status: Closed
Project: Core Server
Component/s: JavaScript, Shell
Affects Version/s: None
Fix Version/s: 2.5.4

Type: Bug Priority: Minor - P4
Reporter: Scott Hernandez (Inactive) Assignee: Mathias Stearn
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-11520 Large customData field asserts, witho... Closed
is duplicated by SERVER-11523 Roles with many duplicate linked role... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

When you run something like this:

var f = function() { 
	var makeBigString = function(bigSize) {
	    var bigStr = 'x';
	    while (bigStr.length < bigSize) {
	        bigStr += bigStr;
	    }
	    return bigStr
	} 
 	var bigstr =  makeBigString(1024*1024*20);
 	return {a:bigstr}; 
};
 
db.eval(f);
 
Object.bsonsize(f());

The places to check see to be in V8ToMongo (scripting/engine_v8.h/cpp), and other function which convert to BSON.



 Comments   
Comment by auto [ 13/Nov/13 ]

Author:

{u'username': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: SERVER-11525 Better error message on oversized BSON in JS
Branch: master
https://github.com/mongodb/mongo/commit/98f35d3ff6e4b6b547618eae26936e69ebff45c0

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