Skip to content

Commit 432d8c3

Browse files
committed
Obsoleting GetTotalDataSize and GetTotalStorageSize in MongoCollection as they will be removed in 2.0.
1 parent 1035e50 commit 432d8c3

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

MongoDB.Driver/MongoCollection.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,6 +1148,7 @@ public virtual CollectionStatsResult GetStats(GetStatsArgs args)
11481148
/// Gets the total data size for this collection (data + indexes).
11491149
/// </summary>
11501150
/// <returns>The total data size.</returns>
1151+
[Obsolete("This method will be removed in the next version of the driver.")]
11511152
public virtual long GetTotalDataSize()
11521153
{
11531154
var totalSize = GetStats().DataSize;
@@ -1164,6 +1165,7 @@ public virtual long GetTotalDataSize()
11641165
/// Gets the total storage size for this collection (data + indexes + overhead).
11651166
/// </summary>
11661167
/// <returns>The total storage size.</returns>
1168+
[Obsolete("This method will be removed in the next version of the driver.")]
11671169
public virtual long GetTotalStorageSize()
11681170
{
11691171
var totalSize = GetStats().StorageSize;

MongoDB.DriverUnitTests/MongoCollectionTests.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2942,17 +2942,21 @@ public void TestStrictWrite()
29422942
}
29432943

29442944
[Test]
2945-
[RequiresServer(StorageEngines = "mmapv1")]
2945+
[RequiresServer(VersionLessThan = "2.8.0")]
29462946
public void TestTotalDataSize()
29472947
{
2948+
#pragma warning disable 618
29482949
var dataSize = _collection.GetTotalDataSize();
2950+
#pragma warning restore
29492951
}
29502952

29512953
[Test]
2952-
[RequiresServer(StorageEngines = "mmapv1")]
2954+
[RequiresServer(VersionLessThan = "2.8.0")]
29532955
public void TestTotalStorageSize()
29542956
{
2957+
#pragma warning disable 618
29552958
var dataSize = _collection.GetTotalStorageSize();
2959+
#pragma warning restore
29562960
}
29572961

29582962
[Test]

MongoDB.DriverUnitTests/RequiresServer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ private void EnsureVersion()
195195

196196
if (VersionLessThan != null)
197197
{
198-
var version = new Version(MinimumVersion);
198+
var version = new Version(VersionLessThan);
199199

200200
if (Configuration.TestServer.BuildInfo.Version >= version)
201201
{

0 commit comments

Comments
 (0)