Вопрос по java, mongodb – Как выполнить команду администратора Монго из Java

8

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

{ enablesharding : "test" }
{ shardcollection : "test.test_collection", key : {"number":1} }

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

mongo.getDb("admin").command("{shardcollection : \"test.test_collection\", key:\"number\":1} }")

Ваш Ответ

3   ответа
2

Documentorg.bson):

MongoDatabase database = client.getDatabase("admin");
Document documentA = database.runCommand(new Document("enablesharding", "test"));
Document documentB = database.runCommand(
        new Document("shardcollection", "testDB.x").append("key", new Document("userId", 1)));
15

DB db = mongo.getDB("admin");
DBObject cmd = new BasicDBObject();
cmd.put("shardcollection", "testDB.x");
cmd.put("key", new BasicDBObject("userId", 1));
CommandResult result = db.command(cmd);
mongo.getDb("admin").runCommandError: User Rate Limit Exceeded
Error: User Rate Limit ExceededmongosError: User Rate Limit ExceededmongodError: User Rate Limit Exceeded
-1

Error: User Rate Limit Exceeded Julias
Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded

Похожие вопросы