jstests/sharding/bulk_shard_insert.js
/**
 * Ensures that the just inserted documents can be found.
 */
Ensures that the just inserted documents can be found.
Ensures that the just inserted documents can be found .
function checkDocuments() {
    var docsFound = coll.find({}, {_id: 0, Counter: 1}).toArray();
    var count = coll.find().count();
    if (docsFound.length != docsInserted) {
        print("Inserted " + docsInserted + " count : " + count +
              " doc count : " + docsFound.length);
        var allFoundDocsSorted = docsFound.sort(function(a, b) {
            return a.Counter - b.Counter;
        });
        var missingValueInfo;
        for (var i = 0; i < docsInserted; i++) {
            if (i != allFoundDocsSorted[i].Counter) {
                missingValueInfo = {expected: i, actual: allFoundDocsSorted[i].Counter};
                break;
            }
        }
        st.printShardingStatus();
        assert(
            false,
            'Inserted number of documents does not match the actual: ' + tojson(missingValueInfo));
    }
}
function checkDocuments ( ) { var docsFound = coll . find ( { } , { _id : 0 , Counter : 1 } ) . toArray ( ) ; var count = coll . find ( ) . count ( ) ; if ( docsFound . length != docsInserted ) { print ( "Inserted " + docsInserted + " count : " + count + " doc count : " + docsFound . length ) ; var allFoundDocsSorted = docsFound . sort ( function ( a , b ) { return a . Counter - b . Counter ; } ) ; var missingValueInfo ; for ( var i = 0 ; i < docsInserted ; i ++ ) { if ( i != allFoundDocsSorted [ i ] . Counter ) { missingValueInfo = { expected : i , actual : allFoundDocsSorted [ i ] . Counter } ; break ; } } st . printShardingStatus ( ) ; assert ( false , 'Inserted number of documents does not match the actual: ' + tojson ( missingValueInfo ) ) ; } }
Ensures that the just inserted documents can be found.
Ensures that the just inserted documents can be found .