Add MongoCollection.RenameCollection

XMLWordPrintableJSON

    • Type: New Feature
    • Resolution: Won't Fix
    • Priority: Major - P3
    • None
    • Affects Version/s: 1.8
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • 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 Stam
              Reporter:
              Tim Kellogg
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: