I would like to write some C# code that is called from a job in sitecore, which basically prunes all our mongodb data that is older than 1 year old. What is the exact C# code for doing that? I want to delete just the data, not drop any "databases". Do I need any specific assemblies/packages? Would I be cleaning out just our collection*.wt and index*.wt files for that?
Also, there's two parts to this; one is removing data that's older than a year old, and one is archiving that same data. I would like to export ALL data in mongodb older than a year into some .CSV or excel backup file (before deleting it from mongodb). What's the exact C# code for that? Can it only be done somehow using http://www.fourthbottle.com/2015/08/mongoexport-in-mongodb.html ? If so, what would be the command for exporting ALL data into a .CSV file, not just a specific collection?
Thanks!