[SERVER-5667] convertToCapped drops all indexes Created: 20/Apr/12  Updated: 15/Aug/12  Resolved: 20/Apr/12

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 2.0.4
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Jeff lee Assignee: Scott Hernandez (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Linux


Operating System: ALL
Participants:

 Description   

Hi,

It looks like convertToCapped doesn't recreate indexes on the collection. I'm not sure whether or not it's intended behavior but if it's not a bug it would be nice if the documentation could be updated to reflect the need to recreate indexes.

http://www.mongodb.org/display/DOCS/Capped+Collections#CappedCollections-Convertingacollectiontocapped

Thanks.

Steps to replicate:

U:Jeffs-MacBook-Air.local> db.foodle.save(

{ id:1, ts:new Date()}

)
U:Jeffs-MacBook-Air.local> db.foodle.ensureIndex(

{ ts:1 }

)
U:Jeffs-MacBook-Air.local> db.foodle.stats()
{
"ns" : "test.foodle",
"count" : 1,
"size" : 48,
"avgObjSize" : 48,
"storageSize" : 4096,
"numExtents" : 1,
"nindexes" : 2,
"lastExtentSize" : 4096,
"paddingFactor" : 1,
"flags" : 1,
"totalIndexSize" : 16352,
"indexSizes" :

{ "_id_" : 8176, "ts_1" : 8176 }

,
"ok" : 1
}
U:Jeffs-MacBook-Air.local> db.runCommand(

{ "convertToCapped":"foodle", size:100 }

)

{ "ok" : 1 }

U:Jeffs-MacBook-Air.local> db.foodle.stats()
{
"ns" : "test.foodle",
"count" : 1,
"size" : 48,
"avgObjSize" : 48,
"storageSize" : 4096,
"numExtents" : 1,
"nindexes" : 0,
"lastExtentSize" : 4096,
"paddingFactor" : 1,
"flags" : 0,
"totalIndexSize" : 0,
"indexSizes" : {

},
"capped" : 1,
"max" : 2147483647,
"ok" : 1
}



 Comments   
Comment by auto [ 07/Jun/12 ]

Author:

{u'login': u'tychoish', u'name': u'Sam Kleinman', u'email': u'samk@10gen.com'}

Message: SERVER-5667 convertToCapped index creation clarification
Branch: master
https://github.com/mongodb/docs/commit/5806056a69d28e848b5dafee025df453a6f26a40

Comment by Scott Hernandez (Inactive) [ 20/Apr/12 ]

Yes, that is by design. I will update the docs to make it clear.

Generated at Thu Feb 08 03:09:33 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.