The .find(loc) call on L 174 will be 4+ orders of magnitude slower than this and should be unnecessary, but I'm not sure pymongo offers any way to move a record from one collection to the other w/o fetching it. Oh well.