MongoDB
 sql >> Database >  >> NoSQL >> MongoDB

come eseguire il comando mongo admin da java

L'ho appena trovato

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);