Due to some specific business requirement we were storing data into the MongoDB's capped collection but now complete requirement changed and we want ot preserve all records in that collection.
I am able to find "convertToCapped" command but didn't find any command to perform vise versa operation.
How can I convert it back to non-capped collection?
You can copy it:
use admin
db.runCommand( { renameCollection: "yourdb.yourcollection", to: "yourdb.oldcapped" } )
use yourdb
db.oldcapped.copyTo("yourcollection")
Then ensure required indexes and create users in uncapped yourcollection
. Run your tests, and if you are happy with results, drop oldcapped
.
Needless to say it should be done within maintenance window.