-
Type: Bug
-
Resolution: Won't Fix
-
Priority: Minor - P4
-
Affects Version/s: 1.4, 1.4.8
-
Component/s: None
In mongoDB shell when you execute a db.ensureIndex() command it will return an error obj if the index already exists but has a differing spec than the one specified.
example in shell
db.foo.ensureIndex(
{ foo : 1 });
"createdCollectionAutomatically" : false,
"numIndexesBefore" : 1,
"numIndexesAfter" : 2,
"ok" : 1
}
db.foo.ensureIndex(
,
{ unique : true });
{
"ok" : 0,
"errmsg" : "Index with name: foo_1 already exists with different options",
"code" : 85
}
In the current node driver, if you execute a collection.ensureIndex() it does not return an error if the index differs from the desired index options. This means in Node there isn't a pathway to determine if there is a conflicting index state. Could ensureIndex be modified so that it returns an error on differing options?