def post_migrate(): """ Post-migration phase: index generations, cross-document relationships. """ for country in Country.find(): country['capital_city'] = City.find_one({ 'old_pk': country['old_capitalcity_pk']})._id del country['old_capitalcity_pk'] country.save() for cls in (City, Country, Region): cls.generate_index(cls.collection)
def post_migrate(): """ Post-migration phase: index generations, cross-document relationships. """ for country in Country.find(): country['capital_city'] = City.find_one({ 'old_pk': country['old_capitalcity_pk'] })._id del country['old_capitalcity_pk'] country.save() for cls in (City, Country, Region): cls.generate_index(cls.collection)