Exportv4 cs mongodb into es

I suggest we keep stuff that messes with the command line (and calls Exit) within this function. I made a suggestion for code that does that in the PR that merged into this one.