[JAVA-238] add optional parameter dropTarget to DBCollection.rename() Created: 20/Dec/10  Updated: 17/Mar/11  Resolved: 07/Feb/11

Status: Closed
Project: Java Driver
Component/s: API
Affects Version/s: 2.3
Fix Version/s: 2.5

Type: Improvement Priority: Minor - P4
Reporter: Swen Thümmler Assignee: Antoine Girbal
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related

 Description   

The mongodb shell allows to rename a collection and optionally drop the target. It would be great to be able to do this in the java driver, too. I.E.:
public DBCollection rename( String newName, boolean dropTarget )
throws MongoException

{ CommandResult ret = _db.getSisterDB( "admin" ) .command( BasicDBObjectBuilder.start() .add( "renameCollection" , _fullName ) .add( "to" , _db._name + "." + newName ) .add( "dropTarget", dropTarget) .get() ); ret.throwOnError(); resetIndexCache(); return _db.getCollection( newName ); }

 Comments   
Comment by auto [ 15/Mar/11 ]

Author:

{u'login': u'bwmcadams', u'name': u'Brendan W. McAdams', u'email': u'brendan@10gen.com'}

Message: SCALA-22 Added a dropTarget boolean option to rename collection, which
specifies behavior if named target collection already exists, proxies
JAVA-238
https://github.com/mongodb/casbah/commit/25e2c29074b64f15ca6e37d85a8cd71a97c4e264

Comment by Antoine Girbal [ 07/Feb/11 ]

implemented and added test

Comment by auto [ 07/Feb/11 ]

Author:

{u'login': u'agirbal', u'name': u'agirbal', u'email': u'antoine@10gen.com'}

Message: JAVA-238: add optional parameter dropTarget to DBCollection.rename()
https://github.com/mongodb/mongo-java-driver/commit/2ae5e43f618d113adda2468d4e93437ce0cb57ab

Generated at Thu Feb 08 08:51:49 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.