mongo pkg util func
refactor