posts
이라는 사전 목록을 mongo에 삽입하려고 시도했지만 수정 방법을 모르는 BulkWriteError: batch op errors occurred
오류가 발생했습니다.Pymongo insert_many BulkWriteError
posts:
[{'#AUTHID': 'fffafe151f07a30a0ede2038a897b680',
'Records': [
{'DATE': '07/22/09 05:54 PM',
'STATUS': 'Is flying back friday night in time to move the rest of his stuff then go to work the next morning... great.'},
......
{'DATE': '07/19/09 04:39 PM', 'STATUS': 'is stealing his net by the lake'}]},
{'#AUTHID': 'fffafe151f07a30a0ede2038a897b680',
'Records': [
{'DATE': '07/22/09 05:54 PM',
'STATUS': 'Is flying back friday night in time to move the rest of his stuff then go to work the next morning... great.'},
{'DATE': '07/19/09 04:39 PM', 'STATUS': 'is stealing his net by the lake'},
....
내가 사용하는 코드 : 다음
collection = db.posts
collection.insert_many(p for p in posts)
하지만 BulkWriteError: batch op errors occurred
을 말한다 오류를 가지고 만
#AUTHID
에 해당) 최초의 사전을 가져 관리
비슷한 상황을 설명하는 링크를 찾았지만 왜 이런 일이 발생하는지 또는 해결 방법에 대해 많이 설명하지 않습니다. 이 문제. 아래에 있습니다. _ PyMongo가 내 문서 모두에 id 필드를 추가하는 이유는 무엇입니까? 다음 링크에서 :
https://github.com/mongodb/mongo-python-driver/blob/master/doc/faq.rst#id25
위의 샘플'posts'에 따르면 내용이 동일하기 때문에 문서가 복제 된 것 같습니다. ** 단일 문서 **를 여러 개로 삽입하는 것에 대한 FAQ가 나와 있습니다. 나는 당신의'dict (s)'이 같은 경우라고 생각합니다. – CallMeLaNN