一、创建索引
创建正序索引
BasicDBObject indexOptions = new BasicDBObject();
indexOptions.put("fieldName", 1);
mongoOperations.getCollection(tableName).createIndex(indexOptions);创建逆序索引
BasicDBObject indexOptions = new BasicDBObject();
indexOptions.put("fieldName", -1);
mongoOperations.getCollection(tableName).createIndex(indexOptions);创建唯一索引
BasicDBObject indexOptions = new BasicDBObject();
indexOptions.put("fieldName", 1);
mongoOperations.getCollection(tableName).createIndex(indexOptions, new IndexOptions().unique(true));创建复合索引
BasicDBObject indexOptions = new BasicDBObject();
indexOptions.put("fieldName", 1);
indexOptions.put("fieldName2", 1);
mongoOperations.getCollection(tableName).createIndex(indexOptions);
二、删除索引
BasicDBObject indexOptions = new BasicDBObject();
indexOptions.put("fieldName", 1);
mongoOperations.getCollection(tableName).dropIndex(indexOptions);
三、删除表
 mongoOperations.getCollection(tableName).drop();