JSON导入
1. 打开Collection
import json
import pymongo
client = pymongo.MongoClient('localhost')
db = client['mydb']
collection = db['images']
2.打开json并写入到Collection
with open("e:/images.json", encoding="utf-8") as jf:
str = jf.read()
data = []
data.extend(json.loads(str)