在我的 mongodb 设置中,我有一个复合分片键{"region" : 1, "foo" : 1, "bar" : 1}
,我知道值区域可以是,并且每个区域应该在一个块上。
因此,我只想根据区域键进行预拆分。之后的分片状态应如下所示:
{ "region": { "$minKey" : 1 }, "foo": { "$minKey" : 1 }, "bar": { "$minKey" : 1 } } -> { "region": region1, "foo": { "$minKey" : 1 }, "bar": { "$minKey" : 1 } } on: shard1
{ "region": region1, "foo": { "$minKey" : 1 }, "bar": { "$minKey" : 1 } } -> { "region": region2, "foo": { "$minKey" : 1 }, "bar": …
Run Code Online (Sandbox Code Playgroud)