is there a way to "uncap" a capped collection? Creating a new collection and copy the data isn't an option for me.
thanks
You can convert a non-capped collection to a capped collection with the convertToCapped command: db. runCommand({"convertToCapped": "mycoll", size: 100000}); The size parameter specifies the size of the capped collection in bytes.
You cannot delete documents from a capped collection. It can only be deleted automatically upon insertion of new documents when the allocated size to the collection has been exhausted. After reading the documents from a capped collection, MongoDB returns the same document in the order which they were present on disk.
What Is a Capped Collection in MongoDB? Fixed-size collections are called capped collections in MongoDB. While creating a collection, the user must specify the collection's maximum size in bytes and the maximum number of documents that it would store.
Right-click on collection1 collection in DB Explorer and select Duplicate 'collection1' Collection... item in the popup menu. Specify destination collection name, duplication parameters and click Duplicate.
No, You can convert a non-capped collection to a capped collection using the "convertToCapped" command but there's no way to go the other way.
Your only option is to clone the collection to a non capped one and rename it which obviously involves downtime.
Unfortunately, the only option here is to copy collection, remove the old one and rename the new one:
$> db.collection_name.copyTo('collection_name2')
$> db.collection_name.isCapped()
true
$> db.collection_name.drop()
$> db.collection_name2.renameCollection('collection_name')
$> db.collection_name.isCapped()
false
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With