[CSHARP-1178] MaxSize is ignored when creating a capped collection Created: 01/Feb/15  Updated: 02/Apr/16  Resolved: 02/Feb/15

Status: Closed
Project: C# Driver
Component/s: API, Operations
Affects Version/s: 2.0
Fix Version/s: 2.0

Type: Bug Priority: Major - P3
Reporter: Bar Arnon Assignee: Unassigned
Resolution: Done Votes: 0
Labels: rc
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


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



 Comments   
Comment by Githook User [ 02/Feb/15 ]

Author:

{u'username': u'BarArnon', u'name': u'Bar Arnon', u'email': u'barnon@microsoft.com'}

Message: CSHARP-1178: Treat capped collection max size as long instead of int.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/0b94545542b8ae5782727335a697c8fb585689eb

Generated at Wed Feb 07 21:38:53 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.