Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-238

add optional parameter dropTarget to DBCollection.rename()

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.5
    • Affects Version/s: 2.3
    • Component/s: API
    • None

      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 ); }

            Assignee:
            antoine Antoine Girbal
            Reporter:
            grmblfrz Swen Thümmler
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: