Our application logs a large amount of data and as a result we have to archive the data and move it off of the production machine once per week. Right now this is a manual process, but I am automating it. Basically, I use 'mongodump' and compress the output, then move it into the cloud and delete the logged data on the production machine.
My question is how do I ensure mongodump was successful before I delete all of the documents in the database? Basic Pseudo code below:
if(mongodumpIsSuccessful)
{
//delete all document in log collection
}
else
{
//handle failed mongodump
}
I have looked through the documentation but I can't seem to find anything. Is there a better way to accomplish what I am trying to do that doesn't use mongodump? Thanks. it