com.mongodb.client.model.RenameCollectionOptions Java Examples

The following examples show how to use com.mongodb.client.model.RenameCollectionOptions. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MongoCollectionRename.java    From openbd-core with GNU General Public License v3.0 6 votes vote down vote up
public cfData execute(cfSession _session, cfArgStructData argStruct ) throws cfmRunTimeException {
	MongoDatabase	db	= getMongoDatabase( _session, argStruct );
	
	String collection	= getNamedStringParam(argStruct, "collection", null);
	if ( collection == null )
		throwException(_session, "please specify a collection");
	
	String name	= getNamedStringParam(argStruct, "name", null);
	if ( name == null )
		throwException(_session, "please specify a name");
	
	try{
		
		db
			.getCollection( collection )
			.renameCollection( new MongoNamespace( db.getName(), name ), new RenameCollectionOptions().dropTarget( getNamedBooleanParam(argStruct, "droptarget", false ) ) );

		return cfBooleanData.TRUE;
		
	} catch (MongoException me){
		throwException(_session, me.getMessage());
		return null;
	}
}
 
Example #2
Source File: MongoCollectionImpl.java    From mongo-java-driver-rx with Apache License 2.0 5 votes vote down vote up
@Override
public Observable<Success> renameCollection(final MongoNamespace newCollectionNamespace, final RenameCollectionOptions options) {
    return RxObservables.create(Observables.observe(new Block<SingleResultCallback<Success>>() {
        @Override
        public void apply(final SingleResultCallback<Success> callback) {
            wrapped.renameCollection(newCollectionNamespace, options, voidToSuccessCallback(callback));
        }
    }), observableAdapter);
}
 
Example #3
Source File: MongoCollectionImpl.java    From mongo-java-driver-reactivestreams with Apache License 2.0 5 votes vote down vote up
@Override
public Publisher<Success> renameCollection(final MongoNamespace newCollectionNamespace, final RenameCollectionOptions options) {
    return new ObservableToPublisher<Success>(com.mongodb.async.client.Observables.observe(
            new Block<com.mongodb.async.SingleResultCallback<Success>>() {
                @Override
                public void apply(final com.mongodb.async.SingleResultCallback<Success> callback) {
                    wrapped.renameCollection(newCollectionNamespace, options, voidToSuccessCallback(callback));
                }
            }));
}
 
Example #4
Source File: MongoCollectionImpl.java    From mongo-java-driver-reactivestreams with Apache License 2.0 5 votes vote down vote up
@Override
public Publisher<Success> renameCollection(final ClientSession clientSession, final MongoNamespace newCollectionNamespace,
                                           final RenameCollectionOptions options) {
    return new ObservableToPublisher<Success>(com.mongodb.async.client.Observables.observe(
            new Block<com.mongodb.async.SingleResultCallback<Success>>() {
                @Override
                public void apply(final com.mongodb.async.SingleResultCallback<Success> callback) {
                    wrapped.renameCollection(clientSession.getWrapped(), newCollectionNamespace, options,
                            voidToSuccessCallback(callback));
                }
            }));
}
 
Example #5
Source File: ReactiveMongoCollectionImpl.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@Override
public Uni<Void> renameCollection(MongoNamespace newCollectionNamespace, RenameCollectionOptions options) {
    return Wrappers.toUni(collection.renameCollection(newCollectionNamespace, options));
}
 
Example #6
Source File: ReactiveMongoCollectionImpl.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@Override
public Uni<Void> renameCollection(ClientSession clientSession, MongoNamespace newCollectionNamespace,
        RenameCollectionOptions options) {
    return Wrappers.toUni(collection.renameCollection(clientSession, newCollectionNamespace, options));
}
 
Example #7
Source File: MongoCollectionImpl.java    From mongo-java-driver-rx with Apache License 2.0 4 votes vote down vote up
@Override
public Observable<Success> renameCollection(final MongoNamespace newCollectionNamespace) {
    return renameCollection(newCollectionNamespace, new RenameCollectionOptions());
}
 
Example #8
Source File: MongoCollectionImpl.java    From mongo-java-driver-reactivestreams with Apache License 2.0 4 votes vote down vote up
@Override
public Publisher<Success> renameCollection(final MongoNamespace newCollectionNamespace) {
    return renameCollection(newCollectionNamespace, new RenameCollectionOptions());
}
 
Example #9
Source File: MongoCollectionImpl.java    From mongo-java-driver-reactivestreams with Apache License 2.0 4 votes vote down vote up
@Override
public Publisher<Success> renameCollection(final ClientSession clientSession, final MongoNamespace newCollectionNamespace) {
    return renameCollection(clientSession, newCollectionNamespace, new RenameCollectionOptions());
}
 
Example #10
Source File: ReactiveMongoCollection.java    From quarkus with Apache License 2.0 2 votes vote down vote up
/**
 * Rename the collection with oldCollectionName to the newCollectionName.
 *
 * @param newCollectionNamespace the name the collection will be renamed to
 * @param options the options for renaming a collection
 * @return a {@link Uni} completed when the operation is done.
 */
Uni<Void> renameCollection(MongoNamespace newCollectionNamespace, RenameCollectionOptions options);
 
Example #11
Source File: ReactiveMongoCollection.java    From quarkus with Apache License 2.0 2 votes vote down vote up
/**
 * Rename the collection with oldCollectionName to the newCollectionName.
 *
 * @param clientSession the client session with which to associate this operation
 * @param newCollectionNamespace the name the collection will be renamed to
 * @param options the options for renaming a collection
 * @return a {@link Uni} completed when the operation is done.
 */
Uni<Void> renameCollection(ClientSession clientSession, MongoNamespace newCollectionNamespace,
        RenameCollectionOptions options);
 
Example #12
Source File: MongoCollection.java    From mongo-java-driver-rx with Apache License 2.0 2 votes vote down vote up
/**
 * Rename the collection with oldCollectionName to the newCollectionName.
 *
 * @param newCollectionNamespace the name the collection will be renamed to
 * @param options                the options for renaming a collection
 * @return an Observable with a single element indicating when the operation has completed
 * @mongodb.driver.manual reference/commands/renameCollection Rename collection
 */
Observable<Success> renameCollection(MongoNamespace newCollectionNamespace, RenameCollectionOptions options);
 
Example #13
Source File: MongoCollection.java    From mongo-java-driver-reactivestreams with Apache License 2.0 2 votes vote down vote up
/**
 * Rename the collection with oldCollectionName to the newCollectionName.
 *
 * @param newCollectionNamespace the name the collection will be renamed to
 * @param options                the options for renaming a collection
 * @return a publisher with a single element indicating when the operation has completed
 * @mongodb.driver.manual reference/commands/renameCollection Rename collection
 */
Publisher<Success> renameCollection(MongoNamespace newCollectionNamespace, RenameCollectionOptions options);
 
Example #14
Source File: MongoCollection.java    From mongo-java-driver-reactivestreams with Apache License 2.0 2 votes vote down vote up
/**
 * Rename the collection with oldCollectionName to the newCollectionName.
 *
 * @param clientSession the client session with which to associate this operation
 * @param newCollectionNamespace the name the collection will be renamed to
 * @param options                the options for renaming a collection
 * @return a publisher with a single element indicating when the operation has completed
 * @mongodb.driver.manual reference/commands/renameCollection Rename collection
 * @mongodb.server.release 3.6
 * @since 1.7
 */
Publisher<Success> renameCollection(ClientSession clientSession, MongoNamespace newCollectionNamespace,
                                    RenameCollectionOptions options);