jstests/noPassthroughWithMongod/big_predicate.js
// some of these operations have caused a segfault.
some of these operations have caused a segfault.
some of these operations have caused a segfault .
function testMaxDepth() {
    let depth = 100;
    let jobj = buildObj(depth);
    let result;
    jobj.foo = 1;
    assert.commandWorked(result = coll.insert(jobj));
    assert.eq(coll.find({foo: 1}).itcount(), 1);
    for (result; !result.hasWriteError(); depth++) {
        result = coll.update({foo: 1}, {
            $set: {
                ['a' +
                 '.a'.repeat(depth - 1)]: {a: 1},
            }
        });
    }
    assert.eq(result.getWriteError().code, ErrorCodes.Overflow);
    print("Failed at creating a document with a depth of", depth, ".");
    depth--;
    let filterOnLongField = {
        ['a' +
         '.a'.repeat(depth - 1)]: 1
    };
    assert.eq(coll.find(filterOnLongField).itcount(), 1);
    assert.commandWorked(coll.explain().find(filterOnLongField).finish());
    assert.eq(coll.find({foo: 1}, filterOnLongField).itcount(), 1);
    assert.commandWorked(coll.explain().find({foo: 1}, filterOnLongField).finish());
    let sliceProjectionOnLongField = {
        ['a' +
         '.a'.repeat(depth - 1)]: {$slice: 1}
    };
    assert.eq(coll.find({foo: 1}, sliceProjectionOnLongField).itcount(), 1);
    assert.commandWorked(coll.explain().find({foo: 1}, sliceProjectionOnLongField).finish());
    coll.drop();
}
function testMaxDepth ( ) { let depth = 100 ; let jobj = buildObj ( depth ) ; let result ; jobj . foo = 1 ; assert . commandWorked ( result = coll . insert ( jobj ) ) ; assert . eq ( coll . find ( { foo : 1 } ) . itcount ( ) , 1 ) ; for ( result ; ! result . hasWriteError ( ) ; depth ++ ) { result = coll . update ( { foo : 1 } , { $set : { [ 'a' + '.a' . repeat ( depth - 1 ) ] : { a : 1 } , } } ) ; } assert . eq ( result . getWriteError ( ) . code , ErrorCodes . Overflow ) ; print ( "Failed at creating a document with a depth of" , depth , "." ) ; depth -- ; let filterOnLongField = { [ 'a' + '.a' . repeat ( depth - 1 ) ] : 1 } ; assert . eq ( coll . find ( filterOnLongField ) . itcount ( ) , 1 ) ; assert . commandWorked ( coll . explain ( ) . find ( filterOnLongField ) . finish ( ) ) ; assert . eq ( coll . find ( { foo : 1 } , filterOnLongField ) . itcount ( ) , 1 ) ; assert . commandWorked ( coll . explain ( ) . find ( { foo : 1 } , filterOnLongField ) . finish ( ) ) ; let sliceProjectionOnLongField = { [ 'a' + '.a' . repeat ( depth - 1 ) ] : { $slice : 1 } } ; assert . eq ( coll . find ( { foo : 1 } , sliceProjectionOnLongField ) . itcount ( ) , 1 ) ; assert . commandWorked ( coll . explain ( ) . find ( { foo : 1 } , sliceProjectionOnLongField ) . finish ( ) ) ; coll . drop ( ) ; }
some of these operations have caused a segfault.
some of these operations have caused a segfault .