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

MaxBytesToReturnToClientAtOnce seems inconsistent with BSONObjMaxUserSize

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • None
    • ALL

          /* Note the limit here is rather arbitrary and is simply a standard. generally the code works
             with any object that fits in ram.
      
             Also note that the server has some basic checks to enforce this limit but those checks are not exhaustive
             for example need to check for size too big after
               update $push (append) operation
               various db.eval() type operations
          */
          const int BSONObjMaxUserSize = 16 * 1024 * 1024;
      
          /* We cut off further objects once we cross this threshold; thus, you might get
             a little bit more than this, it is a threshold rather than a limit.
          */
          const int MaxBytesToReturnToClientAtOnce = 4 * 1024 * 1024;
      

      If my objects are ~5mb, and I do a find().limit(-2) I will only get one document back.

      test

      c = db.c;
      c.drop();
      
      for( i = 0; i < 2; ++i ) {
          c.save( {} );
      }
      
      print( c.find().limit( -2 ).itcount() );
      
      c.drop();
      
      big = new Array( 5 * 1024 * 1024 ).toString();
      
      for( i = 0; i < 2; ++i ) {
          c.save( {big:big} );
      }
      
      print( c.find().limit( -2 ).itcount() );
      

            Assignee:
            david.storch@mongodb.com David Storch
            Reporter:
            aaron Aaron Staple
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: