jstests/sharding/compound_hashed_shard_key_presplitting.js
/**
 * Helper function to create two non-overlapping interweaving tag ranges for each of the specified
 * zones.
 */
Helper function to create two non-overlapping interweaving tag ranges for each of the specified
zones.
Helper function to create two non - overlapping interweaving tag ranges for each of the specified zones .
function createZoneRanges(coll, zoneNames) {
    let offsetFirstTag = 0, offsetSecondTag = 0;
    for (let zoneName of zoneNames) {
        assert.commandWorked(st.s.adminCommand({
            updateZoneKeyRange: coll.getFullName(),
            min: {
                rangeField1: String.fromCharCode(97 + offsetFirstTag++),
                hashedField: MinKey,
                rangeField2: MinKey
            },
            max: {
                rangeField1: String.fromCharCode(97 + offsetFirstTag++),
                hashedField: MinKey,
                rangeField2: MinKey
            },
            zone: zoneName
        }));
        assert.commandWorked(st.s.adminCommand({
            updateZoneKeyRange: coll.getFullName(),
            min: {
                rangeField1: String.fromCharCode(65 + offsetSecondTag++),
                hashedField: MinKey,
                rangeField2: MinKey
            },
            max: {
                rangeField1: String.fromCharCode(65 + offsetSecondTag++),
                hashedField: MinKey,
                rangeField2: MinKey
            },
            zone: zoneName
        }));
    }
}
function createZoneRanges ( coll , zoneNames ) { let offsetFirstTag = 0 , offsetSecondTag = 0 ; for ( let zoneName of zoneNames ) { assert . commandWorked ( st . s . adminCommand ( { updateZoneKeyRange : coll . getFullName ( ) , min : { rangeField1 : String . fromCharCode ( 97 + offsetFirstTag ++ ) , hashedField : MinKey , rangeField2 : MinKey } , max : { rangeField1 : String . fromCharCode ( 97 + offsetFirstTag ++ ) , hashedField : MinKey , rangeField2 : MinKey } , zone : zoneName } ) ) ; assert . commandWorked ( st . s . adminCommand ( { updateZoneKeyRange : coll . getFullName ( ) , min : { rangeField1 : String . fromCharCode ( 65 + offsetSecondTag ++ ) , hashedField : MinKey , rangeField2 : MinKey } , max : { rangeField1 : String . fromCharCode ( 65 + offsetSecondTag ++ ) , hashedField : MinKey , rangeField2 : MinKey } , zone : zoneName } ) ) ; } }
Helper function to create two non-overlapping interweaving tag ranges for each of the specified
 zones.
Helper function to create two non - overlapping interweaving tag ranges for each of the specified zones .
// Create zone ranges such that first zone has tag ranges [a, b) and [A, B). Second zone has tag // ranges [c, d) and [C, D). Third zone has tag ranges [e, f) and [E, f) so on.