【发布时间】:2021-01-05 07:47:53
【问题描述】:
我有一个 Json 文件,其中包含如下 json 列表:
[{"name":"somename","value":{"$ne":"negativity"}}]
我正在解析或读取此文件并转储到 mongo 中,例如:
for file in os.listdir('/opt/myfiles/test.json'):
with open(file, 'r') as fi:
dict = json.load(fi)
for data in dict:
db.collection.insert(data)
它会抛出一个错误:
bson.errors.InvalidDocument: key '$ne' must not start with '$'
【问题讨论】:
标签: python mongodb pymongo bson robo3t