Added debug logging for mongodb inserts and updates