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

Unhandled exception by creating an inex in a special way

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical - P2
    • Resolution: Works as Designed
    • Affects Version/s: 1.4.2
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Environment:
      Win7 / 64 bit (Virtual Box)
    • Backwards Compatibility:
      Minor Change

      Description

      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);

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: