python - 如何使用python在具有匹配_id的MongoDB表中插入一个新字段?
问题描述
我的 mongodb 中有一个表(table1),如下所示。例如,我只给出了 2 个条目,但计数可以是千......
table1:
_id Name Class
1 'xyz' '12th'
2 'abc' '11th' and so on....
我的笔记本(python)中有另一个表(DataFrame),如下所示
table2:
_id zip_code
1 123
2 121
3 145 and so on....
现在我要求通过 python 程序通过 mongodb table1 进行更新,如下所示。
_id Name Class zip_code
1 'xyz' '12th' 123
2 'abc' '11th' 121
所以基本上我想运行我的 python 代码以将zip_code
col 从table2
插入到table1
mongodb 与匹配_id
。
解决方案
推荐阅读
- pandas - Pandas 比较 - 如何比较 2 个单独数据框中的 2 个日期列
- visual-c++ - 如何在 visaul-Studio 2015 中注释掉多行注释?
- python - 如何在python中将dec转换为hex?
- android - 在 kotlin 中获取 mapbox 的位置权限失败
- python - 如何从列表中删除并排存在于另一个列表中的项目?
- java - 生成具有唯一名称的文件并将数据写入其中
- android - 使用改造从服务器获取数据后如何将数据存储在房间数据库中
- ios - iOS xcode 11 新项目多个错误
- d3.js - 为什么附加的 svg 没有定位在 0,0?
- python - 在 Firebase 托管中使用 Python Google Cloud 函数