remove duplicate code in mongodump