List of usage examples for com.mongodb.client.model RenameCollectionOptions RenameCollectionOptions
RenameCollectionOptions
From source file:com.bluedragon.mongo.MongoCollectionRename.java
License:Open Source License
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 {//from ww w . j av a 2 s . c o m 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; } }
From source file:mongofx.js.api.Collection.java
License:Open Source License
public void renameCollection(String target, boolean dropTarget) { getCollection().renameCollection(new MongoNamespace(mongoDatabase.getName(), target), new RenameCollectionOptions().dropTarget(dropTarget)); }