pymongo insert_many 批量插入

lt=client.fangjia.district_stat_all_0416
dl = dt.find(query)

bf=[]
for m in dl:
    bf.append(m)
    if len(bf)==20000:
        lt.insert_many(bf)
        bf=[]
lt.insert_many(bf)
posted @ 2022-08-19 22:58  luoganttcc  阅读(2)  评论(0编辑  收藏  举报