커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
3주차 12강 mongoDB오류문제 해결이 안됐습니다 ㅠ
undefined주차
북마크
전*국
댓글
5
추천
1
조회수
16
조회수
16
답변 완료

* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.

* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.


데이터베이스 삭제하고 비밀번호도 강의와 똑같이 설정했는데 해결이 되지 않습니다 ㅠ



보고 계신 화면 전체를 캡처해 주시면, 튜터님들이 빠르게 상황을 이해할 수 있어요.




작성한 코드 및 에러 메세지

오류 발생 시, 작성한 코드 전체와 에러 메시지를 첨부해 주세요.

Tip 1) </> 아이콘을 눌러 코드박스를 만들어 보세요.

Tip 2) Ctrl+A(맥의 경우 Command+A) 단축키로 코드를 한 번에 선택할 수 있어요!

#입력한 코드
from pymongo import MongoClient
import certifi
ca = certifi.where()
client = MongoClient('mongodb+srv://test:<sparta>@cluster0.euhwlug.mongodb.net/?retryWrites=true&w=majority', tlsCAFile=ca)
db = client.dbsparta

doc = {
    'name':'bob',
    'age':27
}

db.users.insert_one(doc)

#코드출력값
/usr/local/bin/python3.10 /Users/inguk/Desktop/스파르타/main.py 
Traceback (most recent call last):
  File "/Users/inguk/Desktop/스파르타/main.py", line 12, in <module>
    db.users.insert_one(doc)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pymongo/collection.py", line 621, in insert_one
    self._insert_one(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pymongo/collection.py", line 562, in _insert_one
    self.__database.client._retryable_write(acknowledged, _insert_command, session)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pymongo/mongo_client.py", line 1476, in _retryable_write
    return self._retry_with_session(retryable, func, s, None)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pymongo/mongo_client.py", line 1349, in _retry_with_session
    return self._retry_internal(retryable, func, session, bulk)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pymongo/_csot.py", line 105, in csot_wrapper
    return func(self, *args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pymongo/mongo_client.py", line 1381, in _retry_internal
    with self._get_socket(server, session) as sock_info:
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 135, in __enter__
    return next(self.gen)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pymongo/mongo_client.py", line 1217, in _get_socket
    with server.get_socket(handler=err_handler) as sock_info:
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 135, in __enter__
    return next(self.gen)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pymongo/pool.py", line 1407, in get_socket
    sock_info = self._get_socket(handler=handler)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pymongo/pool.py", line 1520, in _get_socket
    sock_info = self.connect(handler=handler)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pymongo/pool.py", line 1378, in connect
    sock_info.authenticate()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pymongo/pool.py", line 870, in authenticate
    auth.authenticate(creds, self)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pymongo/auth.py", line 549, in authenticate
    auth_func(credentials, sock_info)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pymongo/auth.py", line 475, in _authenticate_default
    return _authenticate_scram(credentials, sock_info, "SCRAM-SHA-1")
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pymongo/auth.py", line 241, in _authenticate_scram
    res = sock_info.command(source, cmd)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pymongo/pool.py", line 767, in command
    return command(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pymongo/network.py", line 166, in command
    helpers._check_command_response(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pymongo/helpers.py", line 181, in _check_command_response
    raise OperationFailure(errmsg, code, response, max_wire_version)
pymongo.errors.OperationFailure: bad auth : Authentication failed., full error: {'ok': 0, 'errmsg': 'bad auth : Authentication failed.', 'code': 8000, 'codeName': 'AtlasError'}

종료 코드 1(으)로 완료된 프로세스




취소
 공유
취소
댓글 0
댓글 알림
나의얼굴