staged mongo code to save to database instead of csv