Dumps a mongodb collection to file.