jstests/multiVersion/genericBinVersion/keystring_index.js
// NOTE: Documents returned from getDoc are inserted more than once.
Documents returned from getDoc are inserted more than once.
Documents returned from getDoc are inserted more than once .
function insertDocumentsNotUnique(collection, numDocs, getDoc) {
    let fibNum = 0;
    var bulk = collection.initializeUnorderedBulkOp();
    for (let i = 0; i < numDocs; i += fibonacci(fibNum++)) {
        let doc = getDoc(i);
        for (let j = 0; j < fibonacci(fibNum); j++) {
            bulk.insert(doc);
        }
    }
    assert.commandWorked(bulk.execute());
}
function insertDocumentsNotUnique ( collection , numDocs , getDoc ) { let fibNum = 0 ; var bulk = collection . initializeUnorderedBulkOp ( ) ; for ( let i = 0 ; i < numDocs ; i += fibonacci ( fibNum ++ ) ) { let doc = getDoc ( i ) ; for ( let j = 0 ; j < fibonacci ( fibNum ) ; j ++ ) { bulk . insert ( doc ) ; } } assert . commandWorked ( bulk . execute ( ) ) ; }
NOTE: Documents returned from getDoc are inserted more than once.
NOTE : Documents returned from getDoc are inserted more than once .
// fibonacci numbers are used because the fibonnaci sequence is a // exponentially growing sequence that allows us to create documents // that are duplicated X number of times, for many small values of X and // a few large values of X.