-
Type: Bug
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: 1.8.1
-
Component/s: JavaScript, Shell
-
None
-
Environment:Ubuntu, Mac OS X
-
ALL
DESCRIPTION
Specifying autoIndexId : false while creating a capped collection from the JS mongo shell does not prevent creation of an index on _id.
STEPS TO REPRODUCE
$ mongo
> use test
> db.createCollection("mycoll",
);
{ "ok" : 1 }> db.mycoll.getIndexes()
[
{
"name" : "id",
"ns" : "test.mycoll",
"key" :
,
"v" : 0
}
]
> db._dbCommand(
{create:"mycoll2", size:10000000, autoIndexId:false})
{ "ok" : 1 }> db.mycoll2.getIndexes()
[ ]
SUGGESTED RESOLUTION
The current createCollection JS function does not copy the autoIndexId parameter from the passed-in opt object. If the parameter is set in opt, also set it in the cmd object.
Current code:
> db.createCollection
function (name, opt) {
var options = opt || {};
var cmd =
;
var res = this._dbCommand(cmd);
return res;
}
- related to
-
SERVER-12051 autoIndexId=false allowed on non capped collections
- Closed