List of usage examples for com.mongodb DBCollection rename
public DBCollection rename(final String newName, final boolean dropTarget)
From source file:com.hangum.tadpole.mongodb.core.query.MongoDBQuery.java
License:Open Source License
/** * rename collection//from w w w. ja v a2s . c o m * * @param userDB * @param originalName * @param newName * @throws Exception */ public static void renameCollection(UserDBDAO userDB, String originalName, String newName) throws Exception { DBCollection collection = findCollection(userDB, originalName); collection.rename(newName, true); }
From source file:org.greenmongoquery.db.service.impl.MongoServiceImpl.java
License:Open Source License
@Override public void updateCollection(String db, String collection, String updatecollection, Mongo mongo) { DBObject option = new BasicDBObject(); DB dbs = mongo.getDB(db);//ww w. j ava2 s. c o m DBCollection coll = dbs.getCollection(collection); coll.rename(updatecollection, true); }