Is it possible update a database, based on a lookup value?
pipeline = [
{'$limit': 10000}, # to limit query for testing purpose
{'$lookup': # left join of user_cities DB
{'from': 'weather_mapping',
'localField': 'cityId',
'foreignField': 'id',
'as': 'mapping'}
},
{'$lookup': # left join of user_cities DB
{'from': 'weather',
'localField': 'mapping.okato',
'foreignField': 'okato',
'as': 'weahter'}
}, ]
{'$out': 'activity_weather'} #HERE I WOULD LIKE TO UPDATE THE ORIGINAL DOCUMENT RATHER THAN GENERATING A NEW ONE
db['activity'].aggregate(pipeline, allowDiskUse=True)
Is it possible to include an update command rather than '$out' or vice versa put a $lookup inside the update command?