seems like these three lines could get slow since it is doing a get/put for every doc when it could be done in bulk, but whatever.