Skip to content

Commit c54690c

Browse files
committed
CSHARP-1108: changed storageOptions to storageEngine
1 parent add56df commit c54690c

File tree

3 files changed

+26
-21
lines changed

3 files changed

+26
-21
lines changed

MongoDB.Driver/Builders/CollectionOptionsBuilder.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@ public static CollectionOptionsBuilder SetMaxSize(long value)
7777
}
7878

7979
/// <summary>
80-
/// Sets the storage options.
80+
/// Sets the storage engine options.
8181
/// </summary>
8282
/// <param name="value">The value.</param>
8383
/// <returns>The builder (so method calls can be chained).</returns>
84-
public static CollectionOptionsBuilder SetStorageOptions(BsonDocument value)
84+
public static CollectionOptionsBuilder SetStorageEngineOptions(BsonDocument value)
8585
{
86-
return new CollectionOptionsBuilder().SetStorageOptions(value);
86+
return new CollectionOptionsBuilder().SetStorageEngineOptions(value);
8787
}
8888
}
8989

@@ -155,9 +155,9 @@ public CollectionOptionsBuilder SetMaxSize(long value)
155155
/// </summary>
156156
/// <param name="value">The value.</param>
157157
/// <returns>The builder (so method calls can be chained).</returns>
158-
public CollectionOptionsBuilder SetStorageOptions(BsonDocument value)
158+
public CollectionOptionsBuilder SetStorageEngineOptions(BsonDocument value)
159159
{
160-
_document["storageOptions"] = value;
160+
_document["storageEngine"] = value;
161161
return this;
162162
}
163163

MongoDB.Driver/Builders/IndexOptionsBuilder.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ public static IndexOptionsBuilder SetSparse(bool value)
114114
/// </summary>
115115
/// <param name="value">The value.</param>
116116
/// <returns>The builder (so method calls can be chained).</returns>
117-
public static IndexOptionsBuilder SetStorageOptions(BsonDocument value)
117+
public static IndexOptionsBuilder SetStorageEngineOptions(BsonDocument value)
118118
{
119-
return new IndexOptionsBuilder().SetStorageOptions(value);
119+
return new IndexOptionsBuilder().SetStorageEngineOptions(value);
120120
}
121121

122122
/// <summary>
@@ -276,9 +276,9 @@ public IndexOptionsBuilder SetSparse(bool value)
276276
/// </summary>
277277
/// <param name="value">The value.</param>
278278
/// <returns>The builder (so method calls can be chained).</returns>
279-
public IndexOptionsBuilder SetStorageOptions(BsonDocument value)
279+
public IndexOptionsBuilder SetStorageEngineOptions(BsonDocument value)
280280
{
281-
_document["storageOptions"] = value;
281+
_document["storageEngine"] = value;
282282
return this;
283283
}
284284

@@ -460,9 +460,9 @@ public static IndexOptionsBuilder<TDocument> SetSparse(bool value)
460460
/// </summary>
461461
/// <param name="value">The value.</param>
462462
/// <returns>The builder (so method calls can be chained).</returns>
463-
public static IndexOptionsBuilder<TDocument> SetStorageOptions(BsonDocument value)
463+
public static IndexOptionsBuilder<TDocument> SetStorageEngineOptions(BsonDocument value)
464464
{
465-
return new IndexOptionsBuilder<TDocument>().SetStorageOptions(value);
465+
return new IndexOptionsBuilder<TDocument>().SetStorageEngineOptions(value);
466466
}
467467

468468
/// <summary>
@@ -627,9 +627,9 @@ public IndexOptionsBuilder<TDocument> SetSparse(bool value)
627627
/// </summary>
628628
/// <param name="value">The value.</param>
629629
/// <returns>The builder (so method calls can be chained).</returns>
630-
public IndexOptionsBuilder<TDocument> SetStorageOptions(BsonDocument value)
630+
public IndexOptionsBuilder<TDocument> SetStorageEngineOptions(BsonDocument value)
631631
{
632-
_indexOptionsBuilder.SetStorageOptions(value);
632+
_indexOptionsBuilder.SetStorageEngineOptions(value);
633633
return this;
634634
}
635635

MongoDB.DriverUnitTests/MongoCollectionTests.cs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -603,18 +603,23 @@ public void TestCreateCollectionSetCappedSetMaxSize()
603603
}
604604

605605
[Test]
606-
[RequiresServer(StorageEngines = "wiredtiger")]
606+
[RequiresServer(MinimumVersion = "2.7.0")]
607607
public void TestCreateCollectionSetStorageOptions()
608608
{
609-
var collection = _database.GetCollection("cappedcollection");
609+
var collection = _database.GetCollection("storage_engine_collection");
610610
collection.Drop();
611611
Assert.IsFalse(collection.Exists());
612-
var options = CollectionOptions.SetStorageOptions(
613-
new BsonDocument("wiredtiger", new BsonDocument("configString", "block_compressor=zlib")));
612+
var storageEngineOptions = new BsonDocument
613+
{
614+
{ "wiredtiger", new BsonDocument("configString", "block_compressor=zlib") },
615+
{ "mmapv1", new BsonDocument() }
616+
};
617+
var options = CollectionOptions.SetStorageEngineOptions(storageEngineOptions);
614618
_database.CreateCollection(collection.Name, options);
615-
Assert.IsTrue(collection.Exists());
616-
var stats = collection.GetStats();
617-
collection.Drop();
619+
620+
var result = _database.RunCommand("listCollections");
621+
var resultCollection = result.Response["collections"].AsBsonArray.Where(doc => doc["name"] == collection.Name).Single();
622+
Assert.AreEqual(storageEngineOptions, resultCollection["options"]["storageEngine"]);
618623
}
619624

620625
[Test]
@@ -702,7 +707,7 @@ public void TestCreateIndexWithStorageOptions()
702707

703708
_collection.CreateIndex(
704709
IndexKeys.Ascending("x"),
705-
IndexOptions.SetStorageOptions(
710+
IndexOptions.SetStorageEngineOptions(
706711
new BsonDocument("wiredtiger", new BsonDocument("configString", "block_compressor=zlib"))));
707712

708713
var result = _collection.GetIndexes();

0 commit comments

Comments
 (0)