Database Reference
In-Depth Information
Note
In this method, records with closed value of the introduced field are likely to be in the
same chunk and consequently, in the same shard.
Understanding hash-based keys
In this method, the engine uses the given key to make hashes from it using the hash func-
tion. Then, by requesting clients to fetch data, MongoDB uses the hash function to find
the location of each hash key in shards and then routes the client to the correct shard. This
technique ensures that collections are randomly divided between shards and chunks.
The following diagram shows a sharded cluster that uses hash-based keys to split the data-
set:
Note
Using the hash-based method, documents with a close value of the given field are unlikely
to be in the same chunk and thus, the same shard.
Search WWH ::




Custom Search