Grokking MongoDB
Vote

0% completed

​

Hashed Sharding

convertShardKeyToHashed("user1") // Long('801843209332933044') convertShardKeyToHashed("user2") // Long('-4095265838481657615') convertShardKeyToHashed("user3") // Long('-334819384897554775') convertShardKeyToHashed("user4") // Long('4530835083026697314')

Four user IDs that differ by one character produce numbers that have no visible relationship. That output is the whole idea of hashed sharding. MongoDB converts each shard key value into a 64-bit number by using a hash function, and it divides chunks by those numbers and not by the original values.

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content