-
Type: Improvement
-
Resolution: Done
-
Priority: Minor - P4
-
None
-
Affects Version/s: 1.9
-
Component/s: API, Error Handling
-
Environment:MongoDB 2.6
Unable to find source-code formatter for language: cs. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
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".