Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-463

Unexpected and not documented exception in MongoDatabase.CreateCollection(String, IMongoCollectionOptions)

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.5
    • Affects Version/s: 1.4.2
    • Component/s: None
    • None

      I am trying to create a collection which already exists (a capped one, if this
      matters). As far as the method returns `CommandResult`, I expect it to return
      an error information (and I write ahead some code that check for `Ok` and uses
      the error message). But instead the method throws an exception.

      I propose either to document this exception (it is not) or, better, to not
      throw but return an error. The latter is more expected and consistent with,
      say, `DropCollection` which does not throw on missing collections but returns
      error information.

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            nightroman Roman Kuzmin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: