public DBCollection rename ( final String newName , final boolean dropTarget ) { try { executor . execute ( new RenameCollectionOperation ( getNamespace ( ) , new MongoNamespace ( getNamespace ( ) . getDatabaseName ( ) , newName ) , getWriteConcern ( ) ) . dropTarget ( dropTarget ) , getReadConcern ( ) ) ; return getDB ( ) . getCollection ( newName ) ; } catch ( MongoWriteConcernException e ) { throw createWriteConcernException ( e ) ; } }
Change the name of an existing collection .