Moving get document id outside of update loop for forest ecosystem