启用分片mongocxx

时间:2018-03-02 07:17:27

标签: c++ mongodb sharding mongo-cxx-driver

我想知道如何使用mongocxx 3.1.3(Mongo C ++驱动程序)执行这些命令:

sh.enableSharding("YourDB")
sh.shardCollection("YourDB.YourCollection", {field:hashed})

我已经搜索了3个小时但仍未找到方向。有什么想法吗?

1 个答案:

答案 0 :(得分:1)

驱动程序不为此提供帮助程序,但您可以使用mongocxx::database::run_commandenableSharding command手册中指定的参数调用服务器上的命令。