/* 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() );
|