jstests/sharding/compound_hashed_shard_key_sharding_cmds.js
/**
 * Returns an object which has all the shard key fields. The hashed field will have the value
 * provided for 'valueForHashedField'. We are doing this because, the 'bounds' and 'middle'
 * parameters of splitChunk/moveChunk commands expect a hashed value for the hashed field, where as
 * 'find' expect a non-hashed value.
 */
Returns an object which has all the shard key fields. The hashed field will have the value
provided for 'valueForHashedField'.
Returns an object which has all the shard key fields . The hashed field will have the value provided for ' valueForHashedField ' .
function buildObjWithAllShardKeyFields(shardKey, valueForHashedField) {
    let splitObj = {};
    for (let key in shardKey) {
        if (shardKey[key] === "hashed") {
            splitObj[key] = valueForHashedField;
        } else {
            splitObj[key] = 1;
        }
    }
    return splitObj;
}
function buildObjWithAllShardKeyFields ( shardKey , valueForHashedField ) { let splitObj = { } ; for ( let key in shardKey ) { if ( shardKey [ key ] === "hashed" ) { splitObj [ key ] = valueForHashedField ; } else { splitObj [ key ] = 1 ; } } return splitObj ; }
Returns an object which has all the shard key fields.
Returns an object which has all the shard key fields .