jstests/aggregation/sources/densify/partitions.js
// Verify the following test works in the full case without partitions.
Verify the following test works in the full case without partitions.
Verify the following test works in the full case without partitions .
function fullTestOne(stepVal = 1) {
    coll.drop();
    let testDocs = [];
    let testExpected = [];
    testDocs.push({val: 0});
    testExpected.push({val: 0});
    for (let densifyVal = 1; densifyVal < 11; densifyVal++) {
        if (densifyVal % 2 == 0) {
            testDocs.push({val: densifyVal});
            testExpected.push({val: densifyVal});
        } else if (densifyVal % stepVal == 0) {
            testExpected.push({val: densifyVal});
        }
    }
    testDocs.push({val: 11});
    testExpected.push({val: 11});
    assert.commandWorked(coll.insert(testDocs));
    let result = coll.aggregate(
        [{$project: {_id: 0}}, {$densify: {field: "val", range: {step: stepVal, bounds: "full"}}}]);
    const resultArray = result.toArray();
    assert(arrayEq(resultArray, testExpected), buildErrorString(resultArray, testExpected));
}
function fullTestOne ( stepVal = 1 ) { coll . drop ( ) ; let testDocs = [ ] ; let testExpected = [ ] ; testDocs . push ( { val : 0 } ) ; testExpected . push ( { val : 0 } ) ; for ( let densifyVal = 1 ; densifyVal < 11 ; densifyVal ++ ) { if ( densifyVal % 2 == 0 ) { testDocs . push ( { val : densifyVal } ) ; testExpected . push ( { val : densifyVal } ) ; } else if ( densifyVal % stepVal == 0 ) { testExpected . push ( { val : densifyVal } ) ; } } testDocs . push ( { val : 11 } ) ; testExpected . push ( { val : 11 } ) ; assert . commandWorked ( coll . insert ( testDocs ) ) ; let result = coll . aggregate ( [ { $project : { _id : 0 } } , { $densify : { field : "val" , range : { step : stepVal , bounds : "full" } } } ] ) ; const resultArray = result . toArray ( ) ; assert ( arrayEq ( resultArray , testExpected ) , buildErrorString ( resultArray , testExpected ) ) ; }
Verify the following test works in the full case without partitions.
Verify the following test works in the full case without partitions .
// Add an initial document.