"uncap" limited collection of MongoDB

Is there a way to “smash” a limited collection? Creating a new collection and copying data is not an option for me.

thanks

+4
source share
2 answers

No. You can convert a non-capped collection to a limited collection using the "convertToCapped" command, but there is no way to go the other way.

Your only option is to clone the collection into unlimited and rename it, which, obviously, is associated with downtime.

+6
source

Unfortunately, the only option here is to copy the collection, delete 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 
+3
source

Source: https://habr.com/ru/post/1390381/


All Articles