updated logic for updating mongo data