code: 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);
          }
      }
docs: Change the name of an existing collection.
  
  @param newName    specifies the new name of the collection
  @param dropTarget If {@code true}, mongod will drop the collection with the target name if it exists
  @return the collection with new name
  @throws MongoException if target is the name of an existing collection and {@code dropTarget=false}.
  @mongodb.driver.manual reference/command/renameCollection/ Rename Collection