是否可以根据查找值更新数据库?
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)
是否可以包含更新命令而不是' $ out'反之亦然在更新命令中放入$ lookup?