Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-250

`collection.ensureIndex` does not return an error when failing

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.4.9
    • Affects Version/s: 1.4.8
    • Component/s: None
    • 1

      When trying to ensure a unique index :

      Using the shell :
      `db.my_collection.ensureIndex(

      {field1: 1, field2: 1}

      ,

      {unique: true, safe: true}

      )`

      -> "errmsg" : "E11000 duplicate key error index: planotemp.my_collection.$field1_1_ field2_1 dup key: { : \"1319530\", : 360 }"

      Using the driver :
      db.collection('my_collection').ensureIndex(

      { field1: 1, field2: 2 }

      ,

      { unique: true, safe: true }

      , function(err, res) {});

      -> `err` is null

            Assignee:
            christkv Christian Amor Kvalheim
            Reporter:
            sylvainestevez Sylvain ESTEVEZ
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: