Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-11525

Provide nicer message when converting JS to BSON if too big

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.5.4
    • Affects Version/s: None
    • Component/s: JavaScript, Shell
    • Labels:
      None
    • Fully Compatible
    • ALL

      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.

            Assignee:
            mathias@mongodb.com Mathias Stearn
            Reporter:
            scotthernandez Scott Hernandez (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: