Collection' object is not callable. If you meant to call the 'insert' method on a 'Collection' object it is failing because no such method exists. MongoDB 에러 해결
2022. 9. 10. 16:00ㆍ문제 해결
TypeError: 'Collection' object is not callable. If you meant to call the 'insert' method on a 'Collection' object it is failing because no such method exists. MongoDB 에러 해결하기
typeError: 'Collection' 개체를 호출할 수 없습니다. 'Collection' 개체에 대해 'insert' 메서드를 호출하려는 경우 해당 메서드가 없기 때문에 실패합니다. 라는 몽고디비 오류가 발생했다.
🤦♂️ 오류 원인
몽고DB에서 이제 insert 메소드를 더 이상 지원하지 않는다고 한다. 따라서 insert_one()이나 insert_many() 메소드를 이용해서 코드를 작성해야 한다한다.
💁♂️ 해결 후 python <파일 이름>.py 터미널에 입력해 파이썬 파일 실행하기
python <파일 이름>.py 라고 vscode 터미널에 입력해서 작성한 파일을 재실행한다.
👇 예시
python test.py