public void AlterCollectionTest() { DBCollection coll = null; BsonDocument options = null; string clName_alter = "alterCLTest"; string fullName = null; int partition = 0; string type = null; int rs = -1; coll = cs.CreateCollection(clName_alter); fullName = coll.CollSpace.Name + "." + clName_alter; // alter collecton attrubute options = new BsonDocument { { "ReplSize", 0 }, { "ShardingKey", new BsonDocument { { "a", 1 } } }, { "ShardingType", "hash" }, { "Partition", 4096 } }; coll.Alter(options); // check BsonDocument matcher = new BsonDocument { { "Name", fullName } }; DBCursor cur = sdb.GetSnapshot(8, matcher, null, null); BsonDocument obj = cur.Next(); if (null == obj) { Assert.Fail(); } try { rs = obj["ReplSize"].AsInt32; Assert.IsTrue(7 == rs); partition = obj["Partition"].AsInt32; Assert.IsTrue(4096 == partition); type = obj["ShardingType"].AsString; Assert.IsTrue(type.Equals("hash")); } catch (System.Exception) { Assert.Fail(); } }