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

Unhandled exception by creating an inex in a special way

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Critical - P2 Critical - P2
    • None
    • Affects Version/s: 1.4.2
    • Component/s: None
    • Labels:
    • Environment:
      Win7 / 64 bit (Virtual Box)
    • Minor Change

      Creating an index in like so works fine:
      var collection=database.CreateCollection("Categories");
      var category = database.GetCollection("Categories");
      var keys = IndexKeys.Ascending("Name");
      var sort = SortBy.Ascending("Name");
      database.GetCollection("Categories").CreateIndex(keys, IndexOptions.SetUnique(true).SetDropDups(false));

      But creating an index like so (define the options before the CreateIndex throws an unhandled exception in many situations):
      var collection=database.CreateCollection("Categories");
      var category = database.GetCollection("Categories");
      var keys = IndexKeys.Ascending("Name");
      var sort = SortBy.Ascending("Name");
      var options = IndexOptions.SetUnique(true).SetDropDups(false);
      database.GetCollection("Categories").CreateIndex(keys,options);

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            michael stupp Michael Stupp
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: