下面列出了怎么用com.mongodb.client.model.RenameCollectionOptions的API类实例代码及写法,或者点击链接到github查看源代码。
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;
}
}
@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);
}
@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));
}
}));
}
@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));
}
}));
}
@Override
public Uni<Void> renameCollection(MongoNamespace newCollectionNamespace, RenameCollectionOptions options) {
return Wrappers.toUni(collection.renameCollection(newCollectionNamespace, options));
}
@Override
public Uni<Void> renameCollection(ClientSession clientSession, MongoNamespace newCollectionNamespace,
RenameCollectionOptions options) {
return Wrappers.toUni(collection.renameCollection(clientSession, newCollectionNamespace, options));
}
@Override
public Observable<Success> renameCollection(final MongoNamespace newCollectionNamespace) {
return renameCollection(newCollectionNamespace, new RenameCollectionOptions());
}
@Override
public Publisher<Success> renameCollection(final MongoNamespace newCollectionNamespace) {
return renameCollection(newCollectionNamespace, new RenameCollectionOptions());
}
@Override
public Publisher<Success> renameCollection(final ClientSession clientSession, final MongoNamespace newCollectionNamespace) {
return renameCollection(clientSession, newCollectionNamespace, new RenameCollectionOptions());
}
/**
* 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);
/**
* 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);
/**
* 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);
/**
* 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);
/**
* 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);