sh.splitFind()
On this page本页内容
Definition定义
sh.splitFind(namespace, query)
-
Splits the chunk that contains the shard key value specified by the在区块的中点处分割包含query
at the chunk's median point.query
指定的分片键值的区块。sh.splitFind()
creates two roughly equal chunks.创建两个大致相等的块。To split a chunk at a specific point instead, see要在特定点拆分块,请参阅sh.splitAt()
.sh.splitAt()
。Importantmongosh Method
This page documents a
mongosh
method. This is not the documentation for database commands or language-specific drivers, such as Node.js.For the database command, see the
split
command.For MongoDB API drivers, refer to the language-specific MongoDB driver documentation.
For the legacy
mongo
shell documentation, refer to the documentation for the corresponding MongoDB Server release:The method takes the following arguments:该方法采用以下参数:Parameter参数Type类型Description描述namespace
string The namespace (i.e.包含要拆分的区块的分片集合的命名空间(即<database>.<collection>
) of the sharded collection that contains the chunk to split.<database>.<collection>
)。query
document A query document that specifies the shard key value that determines the chunk to split.一个查询文档,用于指定决定要拆分的区块的分片键值。Thesh.splitFind()
method wraps thesplit
command.sh.splitFind()
方法包装split
命令。
Consideration考虑事项
In most circumstances, you should leave chunk splitting to the automated processes within MongoDB.在大多数情况下,应该将区块分割留给MongoDB中的自动化进程。
To use 若要使用sh.splitFind()
, the sharded collection must be populated.sh.splitFind()
,必须填充分片集合。
Example实例
For the sharded collection 对于分片集合test.foo
, the following example splits, at the median point, a chunk that contains the shard key value x: 70
.test.foo
,以下示例在中间点拆分一个包含分片键值x:70
的块。
sh.splitFind( "test.foo", { x: 70 } )