protected void createDatabase() { this.connect(); log.write("MongoDBConnector - enablesharding for database.."); log.write( this.mongoClient.getDB("admin").command(new BasicDBObject("enablesharding", ("twitter")))); log.write("MongoDBConnector - Creating hashed _id index.."); dbCollection.createIndex(new BasicDBObject("_id", "hashed")); log.write("shardCollection twitter.tweets.."); log.write( this.mongoClient .getDB("admin") .command( new BasicDBObject("shardCollection", "twitter.tweets") .append("key", new BasicDBObject("_id", "hashed")))); log.write("MongoDBConnector - Creating indexes"); // dbCollection.createIndex(new BasicDBObject("id", 1), new BasicDBObject("unique", true)); dbCollection.createIndex(new BasicDBObject("text", "text")); log.write("MongoDBConnector - database created"); }