Details
-
Bug
-
Status: Closed
-
Major - P3
-
Resolution: Works as Designed
-
None
-
None
-
None
-
Minor Change
-
ALL
Description
Not sure how to insert a document with no _id in the shell, so this example uses PyMongo. In 2.4.x, if I create a collection with autoIndexId set to false I can insert a document without an _id field and the _id is not automatically created:
>>> c = pymongo.MongoClient()
|
>>> db = c.test
|
>>> coll = db.create_collection("test", capped=True, autoIndexId=False, size=1000)
|
>>> coll.insert({'a': 'a'}, manipulate=False)
|
>>> coll.find_one()
|
{u'a': u'a'}
|
>>> c.server_info()['version']
|
u'2.4.8'
|
In 2.5.5-pre- the _id field is created, regardless of the autoIndexId setting:
>>> c = pymongo.MongoClient()
|
>>> db = c.test
|
>>> coll = db.create_collection("test", capped=True, autoIndexId=False, size=1000)
|
>>> coll.insert({'a': 'a'}, manipulate=False)
|
>>> coll.find_one()
|
{u'a': u'a', u'_id': ObjectId('52d0831332e6147c55bbd61b')}
|
>>> c.server_info()['version']
|
u'2.5.5-pre-'
|
Attachments
Issue Links
- is related to
-
SERVER-12334 Update does not ensure an _id field
-
- Closed
-
- related to
-
SERVER-8237 autoIndexId:false should be disabled
-
- Closed
-
-
SERVER-11611 remove DataFileMgr::insert*
-
- Closed
-