Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-5667

convertToCapped drops all indexes

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.0.4
    • Component/s: None
    • None
    • Environment:
      Linux
    • ALL

      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
      }

            Assignee:
            scotthernandez Scott Hernandez (Inactive)
            Reporter:
            jlee Jeff lee
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: