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

MaxSize is ignored when creating a capped collection

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Component/s: API, Operations
    • Labels:

      Description

      When creating a capped collection using the new driver with the old API (i.e. client.GetServer().) the MaxSize is ignored and the resulting collection is capped at 1GB:

      new MongoClient()
          .GetServer()
          .GetDatabase("HamsterSchool")
          .CreateCollection("Hamsters", CollectionOptions.SetCapped(true).SetMaxSize(5368709120));

      Using the new API however sets the correct MaxSize:

      await new MongoClient().GetDatabase("HamsterSchool")
          .CreateCollectionAsync("Hamsters",
              new CreateCollectionOptions
              {
                  Capped = true,
                  MaxSize = 5368709120
              });

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            I3arnon Bar Arnon
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: