Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-706

Add MongoCollection.RenameCollection

    • Type: Icon: New Feature New Feature
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.8
    • Component/s: None

      This method is different from MongoDatabase.RenameCollection. One is an admin operation, the other isn't. I wrote an extension method that holds me over:

      public static BsonValue RenameCollection<T>(this MongoCollection<T> collection, string newName)
      {
      var javascript = @"db.

      {0}

      .renameCollection('

      {1}

      ');".Inject(collection.Name, newName);
      return collection.Database.Eval(BsonJavaScript.Create(javascript));
      }

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            tkellogg Tim Kellogg
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: