var coll = new MongoClient("mongodb://localhost:27017/").GetServer().GetDatabase("driverBug").GetCollection("coll0");
|
coll.Drop();
|
coll.CreateIndex(IndexKeys.Ascending("fld0"));
|
try
|
{
|
coll.CreateIndex(IndexKeys.Ascending("fld0"), IndexOptions.SetSparse(true));
|
}
|
catch (WriteConcernException ex)
|
{
|
Console.WriteLine(ex.WriteConcernResult.DocumentsAffected); // XXX
|
}
|
"KeyNotFoundException" at line "XXX". I assume that "DocumentsAffected" is not relevant to index creation errors so "InvalidOperationException" or "NotSupportedException" should be thrown in this case. Or maybe return zero, but not "KeyNotFoundException".
|