RenameCollectionOperation renameCollection(final MongoNamespace newCollectionNamespace, final RenameCollectionOptions renameCollectionOptions) { return new RenameCollectionOperation(namespace, newCollectionNamespace, writeConcern) .dropTarget(renameCollectionOptions.isDropTarget()); }
private void executeRenameCollection(@Nullable final ClientSession clientSession, final MongoNamespace newCollectionNamespace, final RenameCollectionOptions renameCollectionOptions) { executor.execute(new RenameCollectionOperation(getNamespace(), newCollectionNamespace, writeConcern) .dropTarget(renameCollectionOptions.isDropTarget()), readConcern, clientSession); }
/** * 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 */ 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); } }
RenameCollectionOperation renameCollection(final MongoNamespace newCollectionNamespace, final RenameCollectionOptions renameCollectionOptions) { return new RenameCollectionOperation(namespace, newCollectionNamespace, writeConcern) .dropTarget(renameCollectionOptions.isDropTarget()); }
private void executeRenameCollection(@Nullable final ClientSession clientSession, final MongoNamespace newCollectionNamespace, final RenameCollectionOptions renameCollectionOptions) { executor.execute(new RenameCollectionOperation(getNamespace(), newCollectionNamespace, writeConcern) .dropTarget(renameCollectionOptions.isDropTarget()), readConcern, clientSession); }
private void executeRenameCollection(@Nullable final ClientSession clientSession, final MongoNamespace newCollectionNamespace, final RenameCollectionOptions renameCollectionOptions) { executor.execute(new RenameCollectionOperation(getNamespace(), newCollectionNamespace, writeConcern) .dropTarget(renameCollectionOptions.isDropTarget()), readConcern, clientSession); }
/** * 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 */ 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); } }